posterly-mcp-server 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +310 -111
  2. package/dist/index.js +190 -894
  3. package/dist/lib/alias-transport.d.ts +84 -0
  4. package/dist/lib/alias-transport.js +193 -0
  5. package/dist/lib/api-client.d.ts +18 -0
  6. package/dist/lib/api-client.js +55 -0
  7. package/dist/lib/preview-token-core.d.ts +62 -0
  8. package/dist/lib/preview-token-core.js +131 -0
  9. package/dist/lib/preview-token.d.ts +23 -0
  10. package/dist/lib/preview-token.js +44 -0
  11. package/dist/lib/tool-registry.d.ts +246 -0
  12. package/dist/lib/tool-registry.js +394 -0
  13. package/dist/lib/tool-runtime.d.ts +68 -0
  14. package/dist/lib/tool-runtime.js +85 -0
  15. package/dist/lib/version.d.ts +1 -1
  16. package/dist/lib/version.js +1 -1
  17. package/dist/tools/audit-google-business-profile.js +1 -1
  18. package/dist/tools/connect-account.d.ts +4 -4
  19. package/dist/tools/connect-account.js +2 -2
  20. package/dist/tools/create-connect-session.d.ts +2 -2
  21. package/dist/tools/create-connect-session.js +2 -2
  22. package/dist/tools/create-post.d.ts +6 -6
  23. package/dist/tools/create-post.js +3 -3
  24. package/dist/tools/create-posts-batch.d.ts +4 -4
  25. package/dist/tools/create-webhook.d.ts +2 -2
  26. package/dist/tools/delete-post.d.ts +34 -10
  27. package/dist/tools/delete-post.js +52 -16
  28. package/dist/tools/generate-captions.d.ts +2 -2
  29. package/dist/tools/generate-image.d.ts +4 -4
  30. package/dist/tools/generate-image.js +2 -2
  31. package/dist/tools/generate-video.d.ts +6 -6
  32. package/dist/tools/generate-video.js +1 -1
  33. package/dist/tools/get-agent-signup-info.js +2 -2
  34. package/dist/tools/get-post.d.ts +16 -1
  35. package/dist/tools/get-post.js +35 -19
  36. package/dist/tools/list-accounts.d.ts +49 -3
  37. package/dist/tools/list-accounts.js +148 -33
  38. package/dist/tools/list-analytics.d.ts +111 -0
  39. package/dist/tools/list-analytics.js +393 -0
  40. package/dist/tools/list-brands.d.ts +38 -3
  41. package/dist/tools/list-brands.js +138 -20
  42. package/dist/tools/list-comments.d.ts +29 -9
  43. package/dist/tools/list-comments.js +75 -34
  44. package/dist/tools/list-conversations.d.ts +32 -9
  45. package/dist/tools/list-conversations.js +63 -27
  46. package/dist/tools/list-google-business-media.js +1 -1
  47. package/dist/tools/list-google-business-reviews.d.ts +32 -9
  48. package/dist/tools/list-google-business-reviews.js +77 -52
  49. package/dist/tools/list-jobs.d.ts +60 -0
  50. package/dist/tools/list-jobs.js +81 -0
  51. package/dist/tools/list-platforms.d.ts +62 -3
  52. package/dist/tools/list-platforms.js +118 -9
  53. package/dist/tools/list-posts.d.ts +2 -2
  54. package/dist/tools/manage-comment.d.ts +102 -0
  55. package/dist/tools/manage-comment.js +125 -0
  56. package/dist/tools/manage-conversation.d.ts +79 -0
  57. package/dist/tools/manage-conversation.js +75 -0
  58. package/dist/tools/manage-google-business-media.d.ts +103 -0
  59. package/dist/tools/manage-google-business-media.js +126 -0
  60. package/dist/tools/manage-google-business-review.d.ts +146 -0
  61. package/dist/tools/manage-google-business-review.js +115 -0
  62. package/dist/tools/manage-oauth-client.d.ts +121 -0
  63. package/dist/tools/manage-oauth-client.js +94 -0
  64. package/dist/tools/manage-webhook.d.ts +99 -0
  65. package/dist/tools/manage-webhook.js +87 -0
  66. package/dist/tools/start-signup.d.ts +2 -2
  67. package/dist/tools/submit-agent-feedback.d.ts +4 -4
  68. package/dist/tools/trigger-platform-helper.d.ts +2 -2
  69. package/dist/tools/update-post.d.ts +62 -11
  70. package/dist/tools/update-post.js +79 -26
  71. package/dist/tools/upload-media.d.ts +32 -9
  72. package/dist/tools/upload-media.js +54 -18
  73. package/dist/tools/validate-post.d.ts +4 -4
  74. package/dist/tools/whoami.d.ts +15 -2
  75. package/dist/tools/whoami.js +221 -25
  76. package/package.json +5 -3
  77. package/scripts/test-alias-transport.mjs +368 -0
  78. package/scripts/test-client-header-sanitization.mjs +78 -0
  79. package/scripts/test-tool-annotations.mjs +38 -17
  80. package/server.json +9 -2
  81. package/src/index.ts +227 -1443
  82. package/src/lib/alias-transport.ts +233 -0
  83. package/src/lib/api-client.ts +65 -0
  84. package/src/lib/preview-token-core.ts +157 -0
  85. package/src/lib/preview-token.ts +54 -0
  86. package/src/lib/tool-registry.ts +538 -0
  87. package/src/lib/tool-runtime.ts +117 -0
  88. package/src/lib/version.ts +1 -1
  89. package/src/tools/audit-google-business-profile.ts +1 -1
  90. package/src/tools/connect-account.ts +2 -2
  91. package/src/tools/create-connect-session.ts +2 -2
  92. package/src/tools/create-post.ts +3 -3
  93. package/src/tools/delete-post.ts +60 -19
  94. package/src/tools/generate-image.ts +2 -2
  95. package/src/tools/generate-video.ts +1 -1
  96. package/src/tools/get-agent-signup-info.ts +2 -2
  97. package/src/tools/get-post.ts +35 -21
  98. package/src/tools/list-accounts.ts +187 -39
  99. package/src/tools/list-analytics.ts +444 -0
  100. package/src/tools/list-brands.ts +162 -26
  101. package/src/tools/list-comments.ts +86 -43
  102. package/src/tools/list-conversations.ts +81 -39
  103. package/src/tools/list-google-business-media.ts +1 -1
  104. package/src/tools/list-google-business-reviews.ts +93 -64
  105. package/src/tools/list-jobs.ts +91 -0
  106. package/src/tools/list-platforms.ts +135 -11
  107. package/src/tools/manage-comment.ts +142 -0
  108. package/src/tools/manage-conversation.ts +89 -0
  109. package/src/tools/manage-google-business-media.ts +147 -0
  110. package/src/tools/manage-google-business-review.ts +139 -0
  111. package/src/tools/manage-oauth-client.ts +116 -0
  112. package/src/tools/manage-webhook.ts +103 -0
  113. package/src/tools/update-post.ts +106 -39
  114. package/src/tools/upload-media.ts +76 -28
  115. package/src/tools/whoami.ts +253 -30
  116. package/tool-annotations.json +76 -149
  117. package/tool-registry.json +2085 -0
  118. package/src/tools/add-google-business-media.ts +0 -50
  119. package/src/tools/create-oauth-client.ts +0 -36
  120. package/src/tools/delete-comment.ts +0 -29
  121. package/src/tools/delete-google-business-media.ts +0 -30
  122. package/src/tools/delete-google-business-review-reply.ts +0 -30
  123. package/src/tools/delete-oauth-client.ts +0 -23
  124. package/src/tools/delete-post-group.ts +0 -17
  125. package/src/tools/delete-webhook.ts +0 -17
  126. package/src/tools/get-account-analytics.ts +0 -171
  127. package/src/tools/get-brand-profile.ts +0 -86
  128. package/src/tools/get-brand.ts +0 -34
  129. package/src/tools/get-comment.ts +0 -47
  130. package/src/tools/get-connect-link.ts +0 -61
  131. package/src/tools/get-connect-session.ts +0 -63
  132. package/src/tools/get-conversation.ts +0 -44
  133. package/src/tools/get-google-business-review-link.ts +0 -30
  134. package/src/tools/get-image-job.ts +0 -36
  135. package/src/tools/get-learned-voice.ts +0 -31
  136. package/src/tools/get-mcp-status.ts +0 -212
  137. package/src/tools/get-performance-profile.ts +0 -47
  138. package/src/tools/get-platform-schema.ts +0 -56
  139. package/src/tools/get-post-analytics.ts +0 -243
  140. package/src/tools/get-post-insights.ts +0 -60
  141. package/src/tools/get-post-missing.ts +0 -16
  142. package/src/tools/get-video-job.ts +0 -36
  143. package/src/tools/list-brand-accounts.ts +0 -36
  144. package/src/tools/reply-google-business-review.ts +0 -32
  145. package/src/tools/reply-to-comment.ts +0 -30
  146. package/src/tools/send-message.ts +0 -28
  147. package/src/tools/suggest-google-business-review-reply.ts +0 -44
  148. package/src/tools/sync-inbox.ts +0 -28
  149. package/src/tools/test-webhook.ts +0 -18
  150. package/src/tools/update-comment.ts +0 -31
  151. package/src/tools/update-oauth-client.ts +0 -38
  152. package/src/tools/update-post-release-id.ts +0 -25
  153. package/src/tools/update-post-status.ts +0 -31
  154. package/src/tools/update-webhook.ts +0 -36
  155. package/src/tools/upload-media-from-url.ts +0 -33
package/src/index.ts CHANGED
@@ -1,1494 +1,278 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { createRequire } from 'node:module';
3
4
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
- import { PosterlyClient } from './lib/api-client.js';
6
+ import type { z } from 'zod';
7
+ import { PosterlyClient, setMcpClientNameResolver } from './lib/api-client.js';
6
8
  import { POSTERLY_MCP_VERSION } from './lib/version.js';
7
9
  import { getToolAnnotations } from './lib/tool-annotations.js';
10
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
11
+ import { AliasTransport, type LegacyAliasValidator } from './lib/alias-transport.js';
12
+ import { StdioPreviewTokens } from './lib/preview-token.js';
13
+ import { parseToolsets, toolsetInstructions, visibleTools, type ToolRegistry } from './lib/tool-registry.js';
14
+ import type { ToolContext } from './lib/tool-runtime.js';
8
15
  import { getAgentSignupInfoTool } from './tools/get-agent-signup-info.js';
9
16
  import { getSignupSessionTool } from './tools/get-signup-session.js';
10
17
  import { startSignupTool } from './tools/start-signup.js';
11
- import { getMcpStatusTool } from './tools/get-mcp-status.js';
18
+ import { whoamiTool } from './tools/whoami.js';
12
19
  import { listAccountsTool } from './tools/list-accounts.js';
13
20
  import { disconnectAccountTool } from './tools/disconnect-account.js';
21
+ import { connectAccountTool } from './tools/connect-account.js';
22
+ import { createConnectSessionTool } from './tools/create-connect-session.js';
23
+ import { createApiKeyTool } from './tools/create-api-key.js';
24
+ import { deleteApiKeyTool } from './tools/delete-api-key.js';
25
+ import { listWorkspaceMembersTool } from './tools/list-workspace-members.js';
26
+ import { manageWorkspaceMemberTool } from './tools/manage-workspace-member.js';
27
+ import { getCreditsTool } from './tools/get-credits.js';
28
+ import { getSubscriptionTool } from './tools/get-subscription.js';
29
+ import { cancelSubscriptionTool } from './tools/cancel-subscription.js';
30
+ import { pauseSubscriptionTool } from './tools/pause-subscription.js';
31
+ import { resumeSubscriptionTool } from './tools/resume-subscription.js';
32
+ import { downgradeSubscriptionTool } from './tools/downgrade-subscription.js';
33
+ import { listOAuthClientsTool } from './tools/list-oauth-clients.js';
34
+ import { manageOAuthClientTool } from './tools/manage-oauth-client.js';
35
+ import { listPlatformsTool } from './tools/list-platforms.js';
36
+ import { triggerPlatformHelperTool } from './tools/trigger-platform-helper.js';
14
37
  import { listBrandsTool } from './tools/list-brands.js';
15
- import { getBrandTool } from './tools/get-brand.js';
16
- import { listBrandAccountsTool } from './tools/list-brand-accounts.js';
17
- import { getBrandProfileTool } from './tools/get-brand-profile.js';
18
- import { getLearnedVoiceTool } from './tools/get-learned-voice.js';
19
- import { getPerformanceProfileTool } from './tools/get-performance-profile.js';
20
- import { getPostInsightsTool } from './tools/get-post-insights.js';
21
38
  import { listPostSuggestionsTool } from './tools/list-post-suggestions.js';
22
39
  import { dismissSuggestionTool } from './tools/dismiss-suggestion.js';
23
- import { createPostTool } from './tools/create-post.js';
24
- import { validatePostTool } from './tools/validate-post.js';
25
40
  import { submitAgentFeedbackTool } from './tools/submit-agent-feedback.js';
26
41
  import { submitProductFeedbackTool } from './tools/submit-product-feedback.js';
42
+ import { validatePostTool } from './tools/validate-post.js';
43
+ import { createPostTool } from './tools/create-post.js';
27
44
  import { createPostsBatchTool } from './tools/create-posts-batch.js';
28
45
  import { findSlotTool } from './tools/find-slot.js';
29
46
  import { listPostsTool } from './tools/list-posts.js';
30
47
  import { uploadMediaTool } from './tools/upload-media.js';
48
+ import { createSignedUploadTool } from './tools/create-signed-upload.js';
49
+ import { createMediaDropTool } from './tools/create-media-drop.js';
50
+ import { listMediaTool } from './tools/list-media.js';
51
+ import { getVideoOptionsTool } from './tools/get-video-options.js';
52
+ import { runVideoFunctionTool } from './tools/run-video-function.js';
53
+ import { generateVideoTool } from './tools/generate-video.js';
54
+ import { listJobsTool } from './tools/list-jobs.js';
55
+ import { generateCaptionsTool } from './tools/generate-captions.js';
56
+ import { generateImageTool } from './tools/generate-image.js';
31
57
  import { getPostTool } from './tools/get-post.js';
32
- import { getPostMissingTool } from './tools/get-post-missing.js';
33
58
  import { askSupportTool } from './tools/ask-support.js';
34
59
  import { updatePostTool } from './tools/update-post.js';
35
- import { updatePostStatusTool } from './tools/update-post-status.js';
36
- import { updatePostReleaseIdTool } from './tools/update-post-release-id.js';
37
60
  import { deletePostTool } from './tools/delete-post.js';
38
- import { deletePostGroupTool } from './tools/delete-post-group.js';
39
- import { whoamiTool } from './tools/whoami.js';
40
- import { generateCaptionsTool } from './tools/generate-captions.js';
41
- import { generateImageTool } from './tools/generate-image.js';
42
- import { getImageJobTool } from './tools/get-image-job.js';
43
- import { getVideoOptionsTool } from './tools/get-video-options.js';
44
- import { runVideoFunctionTool } from './tools/run-video-function.js';
45
- import { generateVideoTool } from './tools/generate-video.js';
46
- import { getVideoJobTool } from './tools/get-video-job.js';
47
- import { getAccountAnalyticsTool } from './tools/get-account-analytics.js';
48
- import { getPostAnalyticsTool } from './tools/get-post-analytics.js';
61
+ import { listAnalyticsTool } from './tools/list-analytics.js';
49
62
  import { listGoogleBusinessReviewsTool } from './tools/list-google-business-reviews.js';
50
- import { getGoogleBusinessReviewLinkTool } from './tools/get-google-business-review-link.js';
51
63
  import { auditGoogleBusinessProfileTool } from './tools/audit-google-business-profile.js';
52
- import { suggestGoogleBusinessReviewReplyTool } from './tools/suggest-google-business-review-reply.js';
53
- import { replyGoogleBusinessReviewTool } from './tools/reply-google-business-review.js';
54
- import { deleteGoogleBusinessReviewReplyTool } from './tools/delete-google-business-review-reply.js';
64
+ import { manageGoogleBusinessReviewTool } from './tools/manage-google-business-review.js';
55
65
  import { listGoogleBusinessMediaTool } from './tools/list-google-business-media.js';
56
- import { addGoogleBusinessMediaTool } from './tools/add-google-business-media.js';
57
- import { deleteGoogleBusinessMediaTool } from './tools/delete-google-business-media.js';
66
+ import { manageGoogleBusinessMediaTool } from './tools/manage-google-business-media.js';
58
67
  import { listConversationsTool } from './tools/list-conversations.js';
59
- import { getConversationTool } from './tools/get-conversation.js';
60
- import { sendMessageTool } from './tools/send-message.js';
68
+ import { manageConversationTool } from './tools/manage-conversation.js';
61
69
  import { listCommentsTool } from './tools/list-comments.js';
62
- import { getCommentTool } from './tools/get-comment.js';
63
- import { replyToCommentTool } from './tools/reply-to-comment.js';
64
- import { updateCommentTool } from './tools/update-comment.js';
65
- import { deleteCommentTool } from './tools/delete-comment.js';
66
- import { syncInboxTool } from './tools/sync-inbox.js';
70
+ import { manageCommentTool } from './tools/manage-comment.js';
67
71
  import { listActivityTool } from './tools/list-activity.js';
68
72
  import { getUpdatesTool } from './tools/get-updates.js';
69
73
  import { listWebhooksTool } from './tools/list-webhooks.js';
70
74
  import { createWebhookTool } from './tools/create-webhook.js';
71
- import { updateWebhookTool } from './tools/update-webhook.js';
72
- import { deleteWebhookTool } from './tools/delete-webhook.js';
73
- import { testWebhookTool } from './tools/test-webhook.js';
74
- import { listPlatformsTool } from './tools/list-platforms.js';
75
- import { getPlatformSchemaTool } from './tools/get-platform-schema.js';
76
- import { triggerPlatformHelperTool } from './tools/trigger-platform-helper.js';
75
+ import { manageWebhookTool } from './tools/manage-webhook.js';
77
76
  import { getXPostingQuotaTool } from './tools/get-x-posting-quota.js';
78
- import { createSignedUploadTool } from './tools/create-signed-upload.js';
79
- import { createMediaDropTool } from './tools/create-media-drop.js';
80
- import { listMediaTool } from './tools/list-media.js';
81
- import { uploadMediaFromUrlTool } from './tools/upload-media-from-url.js';
82
- import { getConnectLinkTool } from './tools/get-connect-link.js';
83
- import { connectAccountTool } from './tools/connect-account.js';
84
- import { createConnectSessionTool } from './tools/create-connect-session.js';
85
- import { getConnectSessionTool } from './tools/get-connect-session.js';
86
- import { createApiKeyTool } from './tools/create-api-key.js';
87
- import { deleteApiKeyTool } from './tools/delete-api-key.js';
88
- import { listWorkspaceMembersTool } from './tools/list-workspace-members.js';
89
- import { manageWorkspaceMemberTool } from './tools/manage-workspace-member.js';
90
- import { getCreditsTool } from './tools/get-credits.js';
91
- import { getSubscriptionTool } from './tools/get-subscription.js';
92
- import { cancelSubscriptionTool } from './tools/cancel-subscription.js';
93
- import { pauseSubscriptionTool } from './tools/pause-subscription.js';
94
- import { resumeSubscriptionTool } from './tools/resume-subscription.js';
95
- import { downgradeSubscriptionTool } from './tools/downgrade-subscription.js';
96
- import { listOAuthClientsTool } from './tools/list-oauth-clients.js';
97
- import { createOAuthClientTool } from './tools/create-oauth-client.js';
98
- import { updateOAuthClientTool } from './tools/update-oauth-client.js';
99
- import { deleteOAuthClientTool } from './tools/delete-oauth-client.js';
100
-
101
- const server = new McpServer({
102
- name: 'posterly',
103
- version: POSTERLY_MCP_VERSION,
104
- });
105
-
106
- const client = new PosterlyClient();
107
-
108
- // Register tools
109
- server.tool(
110
- getAgentSignupInfoTool.name,
111
- getAgentSignupInfoTool.description,
112
- getAgentSignupInfoTool.inputSchema.shape,
113
- getToolAnnotations(getAgentSignupInfoTool.name),
114
- async () => {
115
- try {
116
- const text = await getAgentSignupInfoTool.execute(client);
117
- return { content: [{ type: 'text' as const, text }] };
118
- } catch (err: any) {
119
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
120
- }
121
- }
122
- );
123
-
124
- server.tool(
125
- startSignupTool.name,
126
- startSignupTool.description,
127
- startSignupTool.inputSchema.shape,
128
- getToolAnnotations(startSignupTool.name),
129
- async (input) => {
130
- try {
131
- const text = await startSignupTool.execute(client, input as any);
132
- return { content: [{ type: 'text' as const, text }] };
133
- } catch (err: any) {
134
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
135
- }
136
- }
137
- );
138
-
139
- server.tool(
140
- getSignupSessionTool.name,
141
- getSignupSessionTool.description,
142
- getSignupSessionTool.inputSchema.shape,
143
- getToolAnnotations(getSignupSessionTool.name),
144
- async (input) => {
145
- try {
146
- const text = await getSignupSessionTool.execute(client, input as any);
147
- return { content: [{ type: 'text' as const, text }] };
148
- } catch (err: any) {
149
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
150
- }
151
- }
152
- );
153
-
154
- server.tool(
155
- getMcpStatusTool.name,
156
- getMcpStatusTool.description,
157
- getMcpStatusTool.inputSchema.shape,
158
- getToolAnnotations(getMcpStatusTool.name),
159
- async () => {
160
- try {
161
- const text = await getMcpStatusTool.execute(client);
162
- return { content: [{ type: 'text' as const, text }] };
163
- } catch (err: any) {
164
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
165
- }
166
- }
167
- );
168
-
169
- server.tool(
170
- whoamiTool.name,
171
- whoamiTool.description,
172
- whoamiTool.inputSchema.shape,
173
- getToolAnnotations(whoamiTool.name),
174
- async () => {
175
- try {
176
- const text = await whoamiTool.execute(client);
177
- return { content: [{ type: 'text' as const, text }] };
178
- } catch (err: any) {
179
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
180
- }
181
- }
182
- );
183
-
184
- server.tool(
185
- listAccountsTool.name,
186
- listAccountsTool.description,
187
- listAccountsTool.inputSchema.shape,
188
- getToolAnnotations(listAccountsTool.name),
189
- async (input) => {
190
- try {
191
- const text = await listAccountsTool.execute(client, input as any);
192
- return { content: [{ type: 'text' as const, text }] };
193
- } catch (err: any) {
194
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
195
- }
196
- }
197
- );
198
-
199
- server.tool(
200
- disconnectAccountTool.name,
201
- disconnectAccountTool.description,
202
- disconnectAccountTool.inputSchema.shape,
203
- getToolAnnotations(disconnectAccountTool.name),
204
- async (input) => {
205
- try {
206
- const text = await disconnectAccountTool.execute(client, input as any);
207
- return { content: [{ type: 'text' as const, text }] };
208
- } catch (err: any) {
209
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
210
- }
211
- }
212
- );
213
-
214
- server.tool(
215
- getConnectLinkTool.name,
216
- getConnectLinkTool.description,
217
- getConnectLinkTool.inputSchema.shape,
218
- getToolAnnotations(getConnectLinkTool.name),
219
- async (input) => {
220
- try {
221
- const text = await getConnectLinkTool.execute(client, input as any);
222
- return { content: [{ type: 'text' as const, text }] };
223
- } catch (err: any) {
224
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
225
- }
226
- }
227
- );
228
-
229
- server.tool(
230
- connectAccountTool.name,
231
- connectAccountTool.description,
232
- connectAccountTool.inputSchema.shape,
233
- getToolAnnotations(connectAccountTool.name),
234
- async (input) => {
235
- try {
236
- const text = await connectAccountTool.execute(client, input as any);
237
- return { content: [{ type: 'text' as const, text }] };
238
- } catch (err: any) {
239
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
240
- }
241
- }
242
- );
243
-
244
- server.tool(
245
- createConnectSessionTool.name,
246
- createConnectSessionTool.description,
247
- createConnectSessionTool.inputSchema.shape,
248
- getToolAnnotations(createConnectSessionTool.name),
249
- async (input) => {
250
- try {
251
- const text = await createConnectSessionTool.execute(client, input as any);
252
- return { content: [{ type: 'text' as const, text }] };
253
- } catch (err: any) {
254
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
255
- }
256
- }
257
- );
258
-
259
- server.tool(
260
- getConnectSessionTool.name,
261
- getConnectSessionTool.description,
262
- getConnectSessionTool.inputSchema.shape,
263
- getToolAnnotations(getConnectSessionTool.name),
264
- async (input) => {
265
- try {
266
- const text = await getConnectSessionTool.execute(client, input as any);
267
- return { content: [{ type: 'text' as const, text }] };
268
- } catch (err: any) {
269
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
270
- }
271
- }
272
- );
273
-
274
- server.tool(
275
- createApiKeyTool.name,
276
- createApiKeyTool.description,
277
- createApiKeyTool.inputSchema.shape,
278
- getToolAnnotations(createApiKeyTool.name),
279
- async (input) => {
280
- try {
281
- const text = await createApiKeyTool.execute(client, input as any);
282
- return { content: [{ type: 'text' as const, text }] };
283
- } catch (err: any) {
284
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
285
- }
286
- }
287
- );
288
-
289
- server.tool(
290
- deleteApiKeyTool.name,
291
- deleteApiKeyTool.description,
292
- deleteApiKeyTool.inputSchema.shape,
293
- getToolAnnotations(deleteApiKeyTool.name),
294
- async (input) => {
295
- try {
296
- const text = await deleteApiKeyTool.execute(client, input as any);
297
- return { content: [{ type: 'text' as const, text }] };
298
- } catch (err: any) {
299
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
300
- }
301
- }
302
- );
303
-
304
- server.tool(
305
- listWorkspaceMembersTool.name,
306
- listWorkspaceMembersTool.description,
307
- listWorkspaceMembersTool.inputSchema.shape,
308
- getToolAnnotations(listWorkspaceMembersTool.name),
309
- async (input) => {
310
- try {
311
- const text = await listWorkspaceMembersTool.execute(client, input as any);
312
- return { content: [{ type: 'text' as const, text }] };
313
- } catch (err: any) {
314
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
315
- }
316
- }
317
- );
318
-
319
- server.tool(
320
- manageWorkspaceMemberTool.name,
321
- manageWorkspaceMemberTool.description,
322
- manageWorkspaceMemberTool.inputSchema.shape,
323
- getToolAnnotations(manageWorkspaceMemberTool.name),
324
- async (input) => {
325
- try {
326
- const text = await manageWorkspaceMemberTool.execute(client, input as any);
327
- return { content: [{ type: 'text' as const, text }] };
328
- } catch (err: any) {
329
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
330
- }
331
- }
332
- );
333
-
334
- server.tool(
335
- getCreditsTool.name,
336
- getCreditsTool.description,
337
- getCreditsTool.inputSchema.shape,
338
- getToolAnnotations(getCreditsTool.name),
339
- async () => {
340
- try {
341
- const text = await getCreditsTool.execute(client);
342
- return { content: [{ type: 'text' as const, text }] };
343
- } catch (err: any) {
344
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
345
- }
346
- }
347
- );
348
-
349
- server.tool(
350
- getSubscriptionTool.name,
351
- getSubscriptionTool.description,
352
- getSubscriptionTool.inputSchema.shape,
353
- getToolAnnotations(getSubscriptionTool.name),
354
- async () => {
355
- try {
356
- const text = await getSubscriptionTool.execute(client);
357
- return { content: [{ type: 'text' as const, text }] };
358
- } catch (err: any) {
359
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
360
- }
361
- }
362
- );
363
-
364
- server.tool(
365
- cancelSubscriptionTool.name,
366
- cancelSubscriptionTool.description,
367
- cancelSubscriptionTool.inputSchema.shape,
368
- getToolAnnotations(cancelSubscriptionTool.name),
369
- async (input) => {
370
- try {
371
- const text = await cancelSubscriptionTool.execute(client, input as any);
372
- return { content: [{ type: 'text' as const, text }] };
373
- } catch (err: any) {
374
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
375
- }
376
- }
377
- );
378
-
379
- server.tool(
380
- pauseSubscriptionTool.name,
381
- pauseSubscriptionTool.description,
382
- pauseSubscriptionTool.inputSchema.shape,
383
- getToolAnnotations(pauseSubscriptionTool.name),
384
- async (input) => {
385
- try {
386
- const text = await pauseSubscriptionTool.execute(client, input as any);
387
- return { content: [{ type: 'text' as const, text }] };
388
- } catch (err: any) {
389
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
390
- }
391
- }
392
- );
393
-
394
- server.tool(
395
- resumeSubscriptionTool.name,
396
- resumeSubscriptionTool.description,
397
- resumeSubscriptionTool.inputSchema.shape,
398
- getToolAnnotations(resumeSubscriptionTool.name),
399
- async () => {
400
- try {
401
- const text = await resumeSubscriptionTool.execute(client);
402
- return { content: [{ type: 'text' as const, text }] };
403
- } catch (err: any) {
404
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
405
- }
406
- }
407
- );
408
-
409
- server.tool(
410
- downgradeSubscriptionTool.name,
411
- downgradeSubscriptionTool.description,
412
- downgradeSubscriptionTool.inputSchema.shape,
413
- getToolAnnotations(downgradeSubscriptionTool.name),
414
- async (input) => {
415
- try {
416
- const text = await downgradeSubscriptionTool.execute(client, input as any);
417
- return { content: [{ type: 'text' as const, text }] };
418
- } catch (err: any) {
419
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
420
- }
421
- }
422
- );
423
-
424
- server.tool(
425
- listOAuthClientsTool.name,
426
- listOAuthClientsTool.description,
427
- listOAuthClientsTool.inputSchema.shape,
428
- getToolAnnotations(listOAuthClientsTool.name),
429
- async () => {
430
- try {
431
- const text = await listOAuthClientsTool.execute(client);
432
- return { content: [{ type: 'text' as const, text }] };
433
- } catch (err: any) {
434
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
435
- }
436
- }
437
- );
438
-
439
- server.tool(
440
- createOAuthClientTool.name,
441
- createOAuthClientTool.description,
442
- createOAuthClientTool.inputSchema.shape,
443
- getToolAnnotations(createOAuthClientTool.name),
444
- async (input) => {
445
- try {
446
- const text = await createOAuthClientTool.execute(client, input as any);
447
- return { content: [{ type: 'text' as const, text }] };
448
- } catch (err: any) {
449
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
450
- }
451
- }
452
- );
453
-
454
- server.tool(
455
- updateOAuthClientTool.name,
456
- updateOAuthClientTool.description,
457
- updateOAuthClientTool.inputSchema.shape,
458
- getToolAnnotations(updateOAuthClientTool.name),
459
- async (input) => {
460
- try {
461
- const text = await updateOAuthClientTool.execute(client, input as any);
462
- return { content: [{ type: 'text' as const, text }] };
463
- } catch (err: any) {
464
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
465
- }
466
- }
467
- );
468
-
469
- server.tool(
470
- deleteOAuthClientTool.name,
471
- deleteOAuthClientTool.description,
472
- deleteOAuthClientTool.inputSchema.shape,
473
- getToolAnnotations(deleteOAuthClientTool.name),
474
- async (input) => {
475
- try {
476
- const text = await deleteOAuthClientTool.execute(client, input as any);
477
- return { content: [{ type: 'text' as const, text }] };
478
- } catch (err: any) {
479
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
480
- }
481
- }
482
- );
483
-
484
- server.tool(
485
- listPlatformsTool.name,
486
- listPlatformsTool.description,
487
- listPlatformsTool.inputSchema.shape,
488
- getToolAnnotations(listPlatformsTool.name),
489
- async (input) => {
490
- try {
491
- const text = await listPlatformsTool.execute(client, input as any);
492
- return { content: [{ type: 'text' as const, text }] };
493
- } catch (err: any) {
494
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
495
- }
496
- }
497
- );
498
-
499
- server.tool(
500
- getPlatformSchemaTool.name,
501
- getPlatformSchemaTool.description,
502
- getPlatformSchemaTool.inputSchema.shape,
503
- getToolAnnotations(getPlatformSchemaTool.name),
504
- async (input) => {
505
- try {
506
- const text = await getPlatformSchemaTool.execute(client, input as any);
507
- return { content: [{ type: 'text' as const, text }] };
508
- } catch (err: any) {
509
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
510
- }
511
- }
512
- );
513
-
514
- server.tool(
515
- triggerPlatformHelperTool.name,
516
- triggerPlatformHelperTool.description,
517
- triggerPlatformHelperTool.inputSchema.shape,
518
- getToolAnnotations(triggerPlatformHelperTool.name),
519
- async (input) => {
520
- try {
521
- const text = await triggerPlatformHelperTool.execute(client, input as any);
522
- return { content: [{ type: 'text' as const, text }] };
523
- } catch (err: any) {
524
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
525
- }
526
- }
527
- );
528
-
529
- server.tool(
530
- listBrandsTool.name,
531
- listBrandsTool.description,
532
- listBrandsTool.inputSchema.shape,
533
- getToolAnnotations(listBrandsTool.name),
534
- async (input) => {
535
- try {
536
- const text = await listBrandsTool.execute(client, input as any);
537
- return { content: [{ type: 'text' as const, text }] };
538
- } catch (err: any) {
539
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
540
- }
541
- }
542
- );
543
-
544
- server.tool(
545
- getBrandTool.name,
546
- getBrandTool.description,
547
- getBrandTool.inputSchema.shape,
548
- getToolAnnotations(getBrandTool.name),
549
- async (input) => {
550
- try {
551
- const text = await getBrandTool.execute(client, input as any);
552
- return { content: [{ type: 'text' as const, text }] };
553
- } catch (err: any) {
554
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
555
- }
556
- }
557
- );
558
-
559
- server.tool(
560
- listBrandAccountsTool.name,
561
- listBrandAccountsTool.description,
562
- listBrandAccountsTool.inputSchema.shape,
563
- getToolAnnotations(listBrandAccountsTool.name),
564
- async (input) => {
565
- try {
566
- const text = await listBrandAccountsTool.execute(client, input as any);
567
- return { content: [{ type: 'text' as const, text }] };
568
- } catch (err: any) {
569
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
570
- }
571
- }
572
- );
573
-
574
- server.tool(
575
- getBrandProfileTool.name,
576
- getBrandProfileTool.description,
577
- getBrandProfileTool.inputSchema.shape,
578
- getToolAnnotations(getBrandProfileTool.name),
579
- async (input) => {
580
- try {
581
- const text = await getBrandProfileTool.execute(client, input as any);
582
- return { content: [{ type: 'text' as const, text }] };
583
- } catch (err: any) {
584
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
585
- }
586
- }
587
- );
588
-
589
- server.tool(
590
- getLearnedVoiceTool.name,
591
- getLearnedVoiceTool.description,
592
- getLearnedVoiceTool.inputSchema.shape,
593
- getToolAnnotations(getLearnedVoiceTool.name),
594
- async (input) => {
595
- try {
596
- const text = await getLearnedVoiceTool.execute(client, input as any);
597
- return { content: [{ type: 'text' as const, text }] };
598
- } catch (err: any) {
599
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
600
- }
601
- }
602
- );
603
-
604
- server.tool(
605
- getPerformanceProfileTool.name,
606
- getPerformanceProfileTool.description,
607
- getPerformanceProfileTool.inputSchema.shape,
608
- getToolAnnotations(getPerformanceProfileTool.name),
609
- async (input) => {
610
- try {
611
- const text = await getPerformanceProfileTool.execute(client, input as any);
612
- return { content: [{ type: 'text' as const, text }] };
613
- } catch (err: any) {
614
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
615
- }
616
- }
617
- );
618
-
619
- server.tool(
620
- getPostInsightsTool.name,
621
- getPostInsightsTool.description,
622
- getPostInsightsTool.inputSchema.shape,
623
- getToolAnnotations(getPostInsightsTool.name),
624
- async (input) => {
625
- try {
626
- const text = await getPostInsightsTool.execute(client, input as any);
627
- return { content: [{ type: 'text' as const, text }] };
628
- } catch (err: any) {
629
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
630
- }
631
- }
632
- );
633
-
634
- server.tool(
635
- listPostSuggestionsTool.name,
636
- listPostSuggestionsTool.description,
637
- listPostSuggestionsTool.inputSchema.shape,
638
- getToolAnnotations(listPostSuggestionsTool.name),
639
- async (input) => {
640
- try {
641
- const text = await listPostSuggestionsTool.execute(client, input as any);
642
- return { content: [{ type: 'text' as const, text }] };
643
- } catch (err: any) {
644
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
645
- }
646
- }
647
- );
648
77
 
649
- server.tool(
650
- dismissSuggestionTool.name,
651
- dismissSuggestionTool.description,
652
- dismissSuggestionTool.inputSchema.shape,
653
- getToolAnnotations(dismissSuggestionTool.name),
654
- async (input) => {
655
- try {
656
- const text = await dismissSuggestionTool.execute(client, input as any);
657
- return { content: [{ type: 'text' as const, text }] };
658
- } catch (err: any) {
659
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
660
- }
661
- }
662
- );
663
-
664
- server.tool(
665
- submitAgentFeedbackTool.name,
666
- submitAgentFeedbackTool.description,
667
- submitAgentFeedbackTool.inputSchema.shape,
668
- getToolAnnotations(submitAgentFeedbackTool.name),
669
- async (input) => {
670
- try {
671
- const text = await submitAgentFeedbackTool.execute(client, input as any);
672
- return { content: [{ type: 'text' as const, text }] };
673
- } catch (err: any) {
674
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
675
- }
676
- }
677
- );
678
-
679
- server.tool(
680
- submitProductFeedbackTool.name,
681
- submitProductFeedbackTool.description,
682
- submitProductFeedbackTool.inputSchema.shape,
683
- getToolAnnotations(submitProductFeedbackTool.name),
684
- async (input) => {
685
- try {
686
- const text = await submitProductFeedbackTool.execute(client, input as any);
687
- return { content: [{ type: 'text' as const, text }] };
688
- } catch (err: any) {
689
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
690
- }
691
- }
692
- );
693
-
694
- server.tool(
695
- validatePostTool.name,
696
- validatePostTool.description,
697
- validatePostTool.inputSchema.shape,
698
- getToolAnnotations(validatePostTool.name),
699
- async (input) => {
700
- try {
701
- const text = await validatePostTool.execute(client, input as any);
702
- return { content: [{ type: 'text' as const, text }] };
703
- } catch (err: any) {
704
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
705
- }
706
- }
707
- );
708
-
709
- server.tool(
710
- createPostTool.name,
711
- createPostTool.description,
712
- createPostTool.inputSchema.shape,
713
- getToolAnnotations(createPostTool.name),
714
- async (input) => {
715
- try {
716
- const text = await createPostTool.execute(client, input as any);
717
- return { content: [{ type: 'text' as const, text }] };
718
- } catch (err: any) {
719
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
720
- }
721
- }
722
- );
723
-
724
- server.tool(
725
- createPostsBatchTool.name,
726
- createPostsBatchTool.description,
727
- createPostsBatchTool.inputSchema.shape,
728
- getToolAnnotations(createPostsBatchTool.name),
729
- async (input) => {
730
- try {
731
- const text = await createPostsBatchTool.execute(client, input as any);
732
- return { content: [{ type: 'text' as const, text }] };
733
- } catch (err: any) {
734
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
735
- }
736
- }
737
- );
738
-
739
- server.tool(
740
- findSlotTool.name,
741
- findSlotTool.description,
742
- findSlotTool.inputSchema.shape,
743
- getToolAnnotations(findSlotTool.name),
744
- async (input) => {
745
- try {
746
- const text = await findSlotTool.execute(client, input as any);
747
- return { content: [{ type: 'text' as const, text }] };
748
- } catch (err: any) {
749
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
750
- }
751
- }
752
- );
753
-
754
- server.tool(
755
- listPostsTool.name,
756
- listPostsTool.description,
757
- listPostsTool.inputSchema.shape,
758
- getToolAnnotations(listPostsTool.name),
759
- async (input) => {
760
- try {
761
- const text = await listPostsTool.execute(client, input as any);
762
- return { content: [{ type: 'text' as const, text }] };
763
- } catch (err: any) {
764
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
765
- }
766
- }
767
- );
768
-
769
- server.tool(
770
- uploadMediaTool.name,
771
- uploadMediaTool.description,
772
- uploadMediaTool.inputSchema.shape,
773
- getToolAnnotations(uploadMediaTool.name),
774
- async (input) => {
775
- try {
776
- const text = await uploadMediaTool.execute(client, input as any);
777
- return { content: [{ type: 'text' as const, text }] };
778
- } catch (err: any) {
779
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
780
- }
781
- }
782
- );
783
-
784
- server.tool(
785
- uploadMediaFromUrlTool.name,
786
- uploadMediaFromUrlTool.description,
787
- uploadMediaFromUrlTool.inputSchema.shape,
788
- getToolAnnotations(uploadMediaFromUrlTool.name),
789
- async (input) => {
790
- try {
791
- const text = await uploadMediaFromUrlTool.execute(client, input as any);
792
- return { content: [{ type: 'text' as const, text }] };
793
- } catch (err: any) {
794
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
795
- }
796
- }
797
- );
798
-
799
- server.tool(
800
- createSignedUploadTool.name,
801
- createSignedUploadTool.description,
802
- createSignedUploadTool.inputSchema.shape,
803
- getToolAnnotations(createSignedUploadTool.name),
804
- async (input) => {
805
- try {
806
- const text = await createSignedUploadTool.execute(client, input as any);
807
- return { content: [{ type: 'text' as const, text }] };
808
- } catch (err: any) {
809
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
810
- }
811
- }
812
- );
813
-
814
- server.tool(
815
- createMediaDropTool.name,
816
- createMediaDropTool.description,
817
- createMediaDropTool.inputSchema.shape,
818
- getToolAnnotations(createMediaDropTool.name),
819
- async (input) => {
820
- try {
821
- const text = await createMediaDropTool.execute(client, input as any);
822
- return { content: [{ type: 'text' as const, text }] };
823
- } catch (err: any) {
824
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
825
- }
826
- }
827
- );
828
-
829
- server.tool(
830
- listMediaTool.name,
831
- listMediaTool.description,
832
- listMediaTool.inputSchema.shape,
833
- getToolAnnotations(listMediaTool.name),
834
- async (input) => {
835
- try {
836
- const text = await listMediaTool.execute(client, input as any);
837
- return { content: [{ type: 'text' as const, text }] };
838
- } catch (err: any) {
839
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
840
- }
841
- }
842
- );
843
-
844
- server.tool(
845
- getVideoOptionsTool.name,
846
- getVideoOptionsTool.description,
847
- getVideoOptionsTool.inputSchema.shape,
848
- getToolAnnotations(getVideoOptionsTool.name),
849
- async () => {
850
- try {
851
- const text = await getVideoOptionsTool.execute(client);
852
- return { content: [{ type: 'text' as const, text }] };
853
- } catch (err: any) {
854
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
855
- }
856
- }
857
- );
858
-
859
- server.tool(
860
- runVideoFunctionTool.name,
861
- runVideoFunctionTool.description,
862
- runVideoFunctionTool.inputSchema.shape,
863
- getToolAnnotations(runVideoFunctionTool.name),
864
- async (input) => {
865
- try {
866
- const text = await runVideoFunctionTool.execute(client, input as any);
867
- return { content: [{ type: 'text' as const, text }] };
868
- } catch (err: any) {
869
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
870
- }
871
- }
872
- );
873
-
874
- server.tool(
875
- generateVideoTool.name,
876
- generateVideoTool.description,
877
- generateVideoTool.inputSchema.shape,
878
- getToolAnnotations(generateVideoTool.name),
879
- async (input) => {
880
- try {
881
- const text = await generateVideoTool.execute(client, input as any);
882
- return { content: [{ type: 'text' as const, text }] };
883
- } catch (err: any) {
884
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
885
- }
886
- }
887
- );
888
-
889
- server.tool(
890
- getVideoJobTool.name,
891
- getVideoJobTool.description,
892
- getVideoJobTool.inputSchema.shape,
893
- getToolAnnotations(getVideoJobTool.name),
894
- async (input) => {
895
- try {
896
- const text = await getVideoJobTool.execute(client, input as any);
897
- return { content: [{ type: 'text' as const, text }] };
898
- } catch (err: any) {
899
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
900
- }
901
- }
902
- );
903
-
904
- server.tool(
905
- generateCaptionsTool.name,
906
- generateCaptionsTool.description,
907
- generateCaptionsTool.inputSchema.shape,
908
- getToolAnnotations(generateCaptionsTool.name),
909
- async (input) => {
910
- try {
911
- const text = await generateCaptionsTool.execute(client, input as any);
912
- return { content: [{ type: 'text' as const, text }] };
913
- } catch (err: any) {
914
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
915
- }
916
- }
917
- );
918
-
919
- server.tool(
920
- generateImageTool.name,
921
- generateImageTool.description,
922
- generateImageTool.inputSchema.shape,
923
- getToolAnnotations(generateImageTool.name),
924
- async (input) => {
925
- try {
926
- const text = await generateImageTool.execute(client, input as any);
927
- return { content: [{ type: 'text' as const, text }] };
928
- } catch (err: any) {
929
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
930
- }
931
- }
932
- );
933
-
934
- server.tool(
935
- getImageJobTool.name,
936
- getImageJobTool.description,
937
- getImageJobTool.inputSchema.shape,
938
- getToolAnnotations(getImageJobTool.name),
939
- async (input) => {
940
- try {
941
- const text = await getImageJobTool.execute(client, input as any);
942
- return { content: [{ type: 'text' as const, text }] };
943
- } catch (err: any) {
944
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
945
- }
946
- }
947
- );
948
-
949
- server.tool(
950
- getPostTool.name,
951
- getPostTool.description,
952
- getPostTool.inputSchema.shape,
953
- getToolAnnotations(getPostTool.name),
954
- async (input) => {
955
- try {
956
- const text = await getPostTool.execute(client, input as any);
957
- return { content: [{ type: 'text' as const, text }] };
958
- } catch (err: any) {
959
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
960
- }
961
- }
962
- );
963
-
964
- server.tool(
965
- getPostMissingTool.name,
966
- getPostMissingTool.description,
967
- getPostMissingTool.inputSchema.shape,
968
- getToolAnnotations(getPostMissingTool.name),
969
- async (input) => {
970
- try {
971
- const text = await getPostMissingTool.execute(client, input as any);
972
- return { content: [{ type: 'text' as const, text }] };
973
- } catch (err: any) {
974
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
975
- }
976
- }
977
- );
978
-
979
- server.tool(
980
- askSupportTool.name,
981
- askSupportTool.description,
982
- askSupportTool.inputSchema.shape,
983
- getToolAnnotations(askSupportTool.name),
984
- async (input) => {
985
- try {
986
- const text = await askSupportTool.execute(client, input as any);
987
- return { content: [{ type: 'text' as const, text }] };
988
- } catch (err: any) {
989
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
990
- }
991
- }
992
- );
993
-
994
- server.tool(
995
- updatePostTool.name,
996
- updatePostTool.description,
997
- updatePostTool.inputSchema.shape,
998
- getToolAnnotations(updatePostTool.name),
999
- async (input) => {
1000
- try {
1001
- const text = await updatePostTool.execute(client, input as any);
1002
- return { content: [{ type: 'text' as const, text }] };
1003
- } catch (err: any) {
1004
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1005
- }
1006
- }
1007
- );
1008
-
1009
- server.tool(
1010
- updatePostStatusTool.name,
1011
- updatePostStatusTool.description,
1012
- updatePostStatusTool.inputSchema.shape,
1013
- getToolAnnotations(updatePostStatusTool.name),
1014
- async (input) => {
1015
- try {
1016
- const text = await updatePostStatusTool.execute(client, input as any);
1017
- return { content: [{ type: 'text' as const, text }] };
1018
- } catch (err: any) {
1019
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1020
- }
1021
- }
1022
- );
1023
-
1024
- server.tool(
1025
- updatePostReleaseIdTool.name,
1026
- updatePostReleaseIdTool.description,
1027
- updatePostReleaseIdTool.inputSchema.shape,
1028
- getToolAnnotations(updatePostReleaseIdTool.name),
1029
- async (input) => {
1030
- try {
1031
- const text = await updatePostReleaseIdTool.execute(client, input as any);
1032
- return { content: [{ type: 'text' as const, text }] };
1033
- } catch (err: any) {
1034
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1035
- }
1036
- }
1037
- );
1038
-
1039
- server.tool(
1040
- deletePostTool.name,
1041
- deletePostTool.description,
1042
- deletePostTool.inputSchema.shape,
1043
- getToolAnnotations(deletePostTool.name),
1044
- async (input) => {
1045
- try {
1046
- const text = await deletePostTool.execute(client, input as any);
1047
- return { content: [{ type: 'text' as const, text }] };
1048
- } catch (err: any) {
1049
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1050
- }
1051
- }
1052
- );
1053
-
1054
- server.tool(
1055
- deletePostGroupTool.name,
1056
- deletePostGroupTool.description,
1057
- deletePostGroupTool.inputSchema.shape,
1058
- getToolAnnotations(deletePostGroupTool.name),
1059
- async (input) => {
1060
- try {
1061
- const text = await deletePostGroupTool.execute(client, input as any);
1062
- return { content: [{ type: 'text' as const, text }] };
1063
- } catch (err: any) {
1064
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1065
- }
1066
- }
1067
- );
1068
-
1069
- server.tool(
1070
- getAccountAnalyticsTool.name,
1071
- getAccountAnalyticsTool.description,
1072
- getAccountAnalyticsTool.inputSchema.shape,
1073
- getToolAnnotations(getAccountAnalyticsTool.name),
1074
- async (input) => {
1075
- try {
1076
- const text = await getAccountAnalyticsTool.execute(client, input as any);
1077
- return { content: [{ type: 'text' as const, text }] };
1078
- } catch (err: any) {
1079
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1080
- }
1081
- }
1082
- );
1083
-
1084
- server.tool(
1085
- getPostAnalyticsTool.name,
1086
- getPostAnalyticsTool.description,
1087
- getPostAnalyticsTool.inputSchema.shape,
1088
- getToolAnnotations(getPostAnalyticsTool.name),
1089
- async (input) => {
1090
- try {
1091
- const text = await getPostAnalyticsTool.execute(client, input as any);
1092
- return { content: [{ type: 'text' as const, text }] };
1093
- } catch (err: any) {
1094
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1095
- }
1096
- }
1097
- );
1098
-
1099
- server.tool(
1100
- listGoogleBusinessReviewsTool.name,
1101
- listGoogleBusinessReviewsTool.description,
1102
- listGoogleBusinessReviewsTool.inputSchema.shape,
1103
- getToolAnnotations(listGoogleBusinessReviewsTool.name),
1104
- async (input) => {
1105
- try {
1106
- const text = await listGoogleBusinessReviewsTool.execute(client, input as any);
1107
- return { content: [{ type: 'text' as const, text }] };
1108
- } catch (err: any) {
1109
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1110
- }
1111
- }
1112
- );
1113
-
1114
- server.tool(
1115
- getGoogleBusinessReviewLinkTool.name,
1116
- getGoogleBusinessReviewLinkTool.description,
1117
- getGoogleBusinessReviewLinkTool.inputSchema.shape,
1118
- getToolAnnotations(getGoogleBusinessReviewLinkTool.name),
1119
- async (input) => {
1120
- try {
1121
- const text = await getGoogleBusinessReviewLinkTool.execute(client, input as any);
1122
- return { content: [{ type: 'text' as const, text }] };
1123
- } catch (err: any) {
1124
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1125
- }
1126
- }
1127
- );
1128
-
1129
- server.tool(
1130
- auditGoogleBusinessProfileTool.name,
1131
- auditGoogleBusinessProfileTool.description,
1132
- auditGoogleBusinessProfileTool.inputSchema.shape,
1133
- getToolAnnotations(auditGoogleBusinessProfileTool.name),
1134
- async (input) => {
1135
- try {
1136
- const text = await auditGoogleBusinessProfileTool.execute(client, input as any);
1137
- return { content: [{ type: 'text' as const, text }] };
1138
- } catch (err: any) {
1139
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1140
- }
1141
- }
1142
- );
1143
-
1144
- server.tool(
1145
- suggestGoogleBusinessReviewReplyTool.name,
1146
- suggestGoogleBusinessReviewReplyTool.description,
1147
- suggestGoogleBusinessReviewReplyTool.inputSchema.shape,
1148
- getToolAnnotations(suggestGoogleBusinessReviewReplyTool.name),
1149
- async (input) => {
1150
- try {
1151
- const text = await suggestGoogleBusinessReviewReplyTool.execute(client, input as any);
1152
- return { content: [{ type: 'text' as const, text }] };
1153
- } catch (err: any) {
1154
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1155
- }
1156
- }
1157
- );
1158
-
1159
- server.tool(
1160
- replyGoogleBusinessReviewTool.name,
1161
- replyGoogleBusinessReviewTool.description,
1162
- replyGoogleBusinessReviewTool.inputSchema.shape,
1163
- getToolAnnotations(replyGoogleBusinessReviewTool.name),
1164
- async (input) => {
1165
- try {
1166
- const text = await replyGoogleBusinessReviewTool.execute(client, input as any);
1167
- return { content: [{ type: 'text' as const, text }] };
1168
- } catch (err: any) {
1169
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1170
- }
1171
- }
1172
- );
1173
-
1174
- server.tool(
1175
- deleteGoogleBusinessReviewReplyTool.name,
1176
- deleteGoogleBusinessReviewReplyTool.description,
1177
- deleteGoogleBusinessReviewReplyTool.inputSchema.shape,
1178
- getToolAnnotations(deleteGoogleBusinessReviewReplyTool.name),
1179
- async (input) => {
1180
- try {
1181
- const text = await deleteGoogleBusinessReviewReplyTool.execute(client, input as any);
1182
- return { content: [{ type: 'text' as const, text }] };
1183
- } catch (err: any) {
1184
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1185
- }
1186
- }
1187
- );
1188
-
1189
- server.tool(
1190
- listGoogleBusinessMediaTool.name,
1191
- listGoogleBusinessMediaTool.description,
1192
- listGoogleBusinessMediaTool.inputSchema.shape,
1193
- getToolAnnotations(listGoogleBusinessMediaTool.name),
1194
- async (input) => {
1195
- try {
1196
- const text = await listGoogleBusinessMediaTool.execute(client, input as any);
1197
- return { content: [{ type: 'text' as const, text }] };
1198
- } catch (err: any) {
1199
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1200
- }
1201
- }
1202
- );
1203
-
1204
- server.tool(
1205
- addGoogleBusinessMediaTool.name,
1206
- addGoogleBusinessMediaTool.description,
1207
- addGoogleBusinessMediaTool.inputSchema.shape,
1208
- getToolAnnotations(addGoogleBusinessMediaTool.name),
1209
- async (input) => {
1210
- try {
1211
- const text = await addGoogleBusinessMediaTool.execute(client, input as any);
1212
- return { content: [{ type: 'text' as const, text }] };
1213
- } catch (err: any) {
1214
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1215
- }
1216
- }
1217
- );
1218
-
1219
- server.tool(
1220
- deleteGoogleBusinessMediaTool.name,
1221
- deleteGoogleBusinessMediaTool.description,
1222
- deleteGoogleBusinessMediaTool.inputSchema.shape,
1223
- getToolAnnotations(deleteGoogleBusinessMediaTool.name),
1224
- async (input) => {
1225
- try {
1226
- const text = await deleteGoogleBusinessMediaTool.execute(client, input as any);
1227
- return { content: [{ type: 'text' as const, text }] };
1228
- } catch (err: any) {
1229
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1230
- }
1231
- }
1232
- );
1233
-
1234
- server.tool(
1235
- listConversationsTool.name,
1236
- listConversationsTool.description,
1237
- listConversationsTool.inputSchema.shape,
1238
- getToolAnnotations(listConversationsTool.name),
1239
- async (input) => {
1240
- try {
1241
- const text = await listConversationsTool.execute(client, input as any);
1242
- return { content: [{ type: 'text' as const, text }] };
1243
- } catch (err: any) {
1244
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1245
- }
1246
- }
1247
- );
1248
-
1249
- server.tool(
1250
- getConversationTool.name,
1251
- getConversationTool.description,
1252
- getConversationTool.inputSchema.shape,
1253
- getToolAnnotations(getConversationTool.name),
1254
- async (input) => {
1255
- try {
1256
- const text = await getConversationTool.execute(client, input as any);
1257
- return { content: [{ type: 'text' as const, text }] };
1258
- } catch (err: any) {
1259
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1260
- }
1261
- }
1262
- );
1263
-
1264
- server.tool(
1265
- sendMessageTool.name,
1266
- sendMessageTool.description,
1267
- sendMessageTool.inputSchema.shape,
1268
- getToolAnnotations(sendMessageTool.name),
1269
- async (input) => {
1270
- try {
1271
- const text = await sendMessageTool.execute(client, input as any);
1272
- return { content: [{ type: 'text' as const, text }] };
1273
- } catch (err: any) {
1274
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1275
- }
1276
- }
1277
- );
1278
-
1279
- server.tool(
1280
- listCommentsTool.name,
1281
- listCommentsTool.description,
1282
- listCommentsTool.inputSchema.shape,
1283
- getToolAnnotations(listCommentsTool.name),
1284
- async (input) => {
1285
- try {
1286
- const text = await listCommentsTool.execute(client, input as any);
1287
- return { content: [{ type: 'text' as const, text }] };
1288
- } catch (err: any) {
1289
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1290
- }
1291
- }
1292
- );
1293
-
1294
- server.tool(
1295
- getCommentTool.name,
1296
- getCommentTool.description,
1297
- getCommentTool.inputSchema.shape,
1298
- getToolAnnotations(getCommentTool.name),
1299
- async (input) => {
1300
- try {
1301
- const text = await getCommentTool.execute(client, input as any);
1302
- return { content: [{ type: 'text' as const, text }] };
1303
- } catch (err: any) {
1304
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1305
- }
1306
- }
1307
- );
1308
-
1309
- server.tool(
1310
- replyToCommentTool.name,
1311
- replyToCommentTool.description,
1312
- replyToCommentTool.inputSchema.shape,
1313
- getToolAnnotations(replyToCommentTool.name),
1314
- async (input) => {
1315
- try {
1316
- const text = await replyToCommentTool.execute(client, input as any);
1317
- return { content: [{ type: 'text' as const, text }] };
1318
- } catch (err: any) {
1319
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1320
- }
1321
- }
1322
- );
1323
-
1324
- server.tool(
1325
- updateCommentTool.name,
1326
- updateCommentTool.description,
1327
- updateCommentTool.inputSchema.shape,
1328
- getToolAnnotations(updateCommentTool.name),
1329
- async (input) => {
1330
- try {
1331
- const text = await updateCommentTool.execute(client, input as any);
1332
- return { content: [{ type: 'text' as const, text }] };
1333
- } catch (err: any) {
1334
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1335
- }
1336
- }
1337
- );
1338
-
1339
- server.tool(
1340
- deleteCommentTool.name,
1341
- deleteCommentTool.description,
1342
- deleteCommentTool.inputSchema.shape,
1343
- getToolAnnotations(deleteCommentTool.name),
1344
- async (input) => {
1345
- try {
1346
- const text = await deleteCommentTool.execute(client, input as any);
1347
- return { content: [{ type: 'text' as const, text }] };
1348
- } catch (err: any) {
1349
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1350
- }
1351
- }
1352
- );
1353
-
1354
- server.tool(
1355
- syncInboxTool.name,
1356
- syncInboxTool.description,
1357
- syncInboxTool.inputSchema.shape,
1358
- getToolAnnotations(syncInboxTool.name),
1359
- async (input) => {
1360
- try {
1361
- const text = await syncInboxTool.execute(client, input as any);
1362
- return { content: [{ type: 'text' as const, text }] };
1363
- } catch (err: any) {
1364
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1365
- }
1366
- }
1367
- );
78
+ /**
79
+ * One tool module per file in ./tools. `execute` takes the shared client,
80
+ * the validated input, and the per-call context (tools that do not need the
81
+ * input or context simply ignore them). Merged tools also carry the exact
82
+ * input schemas of the old tools they replaced (`legacySchemas`), so alias
83
+ * calls are validated exactly as before until the alias sunset date.
84
+ */
85
+ interface ToolModule {
86
+ name: string;
87
+ description: string;
88
+ inputSchema: z.ZodObject<z.ZodRawShape>;
89
+ legacySchemas?: Record<string, z.ZodTypeAny>;
90
+ execute(client: PosterlyClient, input: any, ctx: ToolContext): Promise<string>;
91
+ }
1368
92
 
1369
- server.tool(
1370
- listActivityTool.name,
1371
- listActivityTool.description,
1372
- listActivityTool.inputSchema.shape,
1373
- getToolAnnotations(listActivityTool.name),
1374
- async (input) => {
1375
- try {
1376
- const text = await listActivityTool.execute(client, input as any);
1377
- return { content: [{ type: 'text' as const, text }] };
1378
- } catch (err: any) {
1379
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1380
- }
1381
- }
1382
- );
93
+ /**
94
+ * Every stdio tool, in registration order. The order is what tools/list
95
+ * returns, so keep new tools appended where they belong rather than
96
+ * re-sorting: reordering changes the published tool list.
97
+ */
98
+ const STDIO_TOOLS: ToolModule[] = [
99
+ getAgentSignupInfoTool,
100
+ startSignupTool,
101
+ getSignupSessionTool,
102
+ whoamiTool,
103
+ listAccountsTool,
104
+ disconnectAccountTool,
105
+ connectAccountTool,
106
+ createConnectSessionTool,
107
+ createApiKeyTool,
108
+ deleteApiKeyTool,
109
+ listWorkspaceMembersTool,
110
+ manageWorkspaceMemberTool,
111
+ getCreditsTool,
112
+ getSubscriptionTool,
113
+ cancelSubscriptionTool,
114
+ pauseSubscriptionTool,
115
+ resumeSubscriptionTool,
116
+ downgradeSubscriptionTool,
117
+ listOAuthClientsTool,
118
+ manageOAuthClientTool,
119
+ listPlatformsTool,
120
+ triggerPlatformHelperTool,
121
+ listBrandsTool,
122
+ listPostSuggestionsTool,
123
+ dismissSuggestionTool,
124
+ submitAgentFeedbackTool,
125
+ submitProductFeedbackTool,
126
+ validatePostTool,
127
+ createPostTool,
128
+ createPostsBatchTool,
129
+ findSlotTool,
130
+ listPostsTool,
131
+ uploadMediaTool,
132
+ createSignedUploadTool,
133
+ createMediaDropTool,
134
+ listMediaTool,
135
+ getVideoOptionsTool,
136
+ runVideoFunctionTool,
137
+ generateVideoTool,
138
+ listJobsTool,
139
+ generateCaptionsTool,
140
+ generateImageTool,
141
+ getPostTool,
142
+ askSupportTool,
143
+ updatePostTool,
144
+ deletePostTool,
145
+ listAnalyticsTool,
146
+ listGoogleBusinessReviewsTool,
147
+ auditGoogleBusinessProfileTool,
148
+ manageGoogleBusinessReviewTool,
149
+ listGoogleBusinessMediaTool,
150
+ manageGoogleBusinessMediaTool,
151
+ listConversationsTool,
152
+ manageConversationTool,
153
+ listCommentsTool,
154
+ manageCommentTool,
155
+ listActivityTool,
156
+ getUpdatesTool,
157
+ listWebhooksTool,
158
+ createWebhookTool,
159
+ manageWebhookTool,
160
+ getXPostingQuotaTool,
161
+ ];
162
+
163
+ // The tool registry (sets, labels, aliases) ships at the package root next to
164
+ // tool-annotations.json; dist/index.js reads it from one level up.
165
+ const require = createRequire(import.meta.url);
166
+ const registry = require('../tool-registry.json') as ToolRegistry;
167
+
168
+ /**
169
+ * Tool sets to list (POSTERLY_TOOLSETS env or --toolsets=core,inbox). Default
170
+ * is every set, so nobody loses tools. Signup tools are always listed. Sets
171
+ * only filter tools/list: every tool is still registered and callable.
172
+ */
173
+ function requestedToolsets(): string | undefined {
174
+ const flag = process.argv.find((arg) => arg.startsWith('--toolsets='));
175
+ if (flag) return flag.slice('--toolsets='.length);
176
+ return process.env.POSTERLY_TOOLSETS;
177
+ }
1383
178
 
1384
- server.tool(
1385
- getUpdatesTool.name,
1386
- getUpdatesTool.description,
1387
- getUpdatesTool.inputSchema.shape,
1388
- getToolAnnotations(getUpdatesTool.name),
1389
- async (input) => {
1390
- try {
1391
- const text = await getUpdatesTool.execute(client, input as any);
1392
- return { content: [{ type: 'text' as const, text }] };
1393
- } catch (err: any) {
1394
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1395
- }
1396
- }
1397
- );
179
+ const toolsets = parseToolsets(registry, requestedToolsets(), 'stdio');
180
+ if (toolsets.unknown.length > 0) {
181
+ console.error(`posterly MCP: ignoring unknown tool set(s): ${toolsets.unknown.join(', ')}`);
182
+ }
1398
183
 
1399
- server.tool(
1400
- listWebhooksTool.name,
1401
- listWebhooksTool.description,
1402
- listWebhooksTool.inputSchema.shape,
1403
- getToolAnnotations(listWebhooksTool.name),
1404
- async (input) => {
1405
- try {
1406
- const text = await listWebhooksTool.execute(client, input as any);
1407
- return { content: [{ type: 'text' as const, text }] };
1408
- } catch (err: any) {
1409
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1410
- }
1411
- }
184
+ const server = new McpServer(
185
+ {
186
+ name: 'posterly',
187
+ version: POSTERLY_MCP_VERSION,
188
+ },
189
+ {
190
+ // Which tool sets exist, that every set is on by default, how to load
191
+ // fewer, and how preview then confirm works (built from the registry).
192
+ instructions: toolsetInstructions(registry, 'stdio'),
193
+ },
1412
194
  );
1413
195
 
1414
- server.tool(
1415
- createWebhookTool.name,
1416
- createWebhookTool.description,
1417
- createWebhookTool.inputSchema.shape,
1418
- getToolAnnotations(createWebhookTool.name),
1419
- async (input) => {
1420
- try {
1421
- const text = await createWebhookTool.execute(client, input as any);
1422
- return { content: [{ type: 'text' as const, text }] };
1423
- } catch (err: any) {
1424
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1425
- }
1426
- }
1427
- );
196
+ const client = new PosterlyClient();
1428
197
 
1429
- server.tool(
1430
- updateWebhookTool.name,
1431
- updateWebhookTool.description,
1432
- updateWebhookTool.inputSchema.shape,
1433
- getToolAnnotations(updateWebhookTool.name),
1434
- async (input) => {
1435
- try {
1436
- const text = await updateWebhookTool.execute(client, input as any);
1437
- return { content: [{ type: 'text' as const, text }] };
1438
- } catch (err: any) {
1439
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1440
- }
1441
- }
1442
- );
198
+ // The SDK only learns the connected client's identity (e.g. "claude-ai",
199
+ // "chatgpt") once the initialize handshake completes, so this is a resolver
200
+ // read fresh on every request rather than a value captured once here.
201
+ setMcpClientNameResolver(() => server.server.getClientVersion()?.name);
1443
202
 
1444
- server.tool(
1445
- deleteWebhookTool.name,
1446
- deleteWebhookTool.description,
1447
- deleteWebhookTool.inputSchema.shape,
1448
- getToolAnnotations(deleteWebhookTool.name),
1449
- async (input) => {
1450
- try {
1451
- const text = await deleteWebhookTool.execute(client, input as any);
1452
- return { content: [{ type: 'text' as const, text }] };
1453
- } catch (err: any) {
1454
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1455
- }
1456
- }
1457
- );
203
+ // Old tools' exact input schemas, keyed by alias name, from the merged tool
204
+ // modules that replaced them.
205
+ const LEGACY_SCHEMAS = new Map<string, z.ZodTypeAny>();
206
+ for (const tool of STDIO_TOOLS) {
207
+ for (const [alias, schema] of Object.entries(tool.legacySchemas ?? {})) LEGACY_SCHEMAS.set(alias, schema);
208
+ }
1458
209
 
1459
- server.tool(
1460
- testWebhookTool.name,
1461
- testWebhookTool.description,
1462
- testWebhookTool.inputSchema.shape,
1463
- getToolAnnotations(testWebhookTool.name),
1464
- async (input) => {
1465
- try {
1466
- const text = await testWebhookTool.execute(client, input as any);
1467
- return { content: [{ type: 'text' as const, text }] };
1468
- } catch (err: any) {
1469
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1470
- }
210
+ /**
211
+ * Validates an alias call against the old tool's own schema, so a call the
212
+ * old tool rejected gets the same SDK error text it always got (same wording
213
+ * the SDK builds for any tool), and a valid call keeps the old defaults.
214
+ */
215
+ const legacyValidator: LegacyAliasValidator = (aliasName, args) => {
216
+ const schema = LEGACY_SCHEMAS.get(aliasName);
217
+ if (!schema) return null;
218
+ const parsed = schema.safeParse(args ?? {});
219
+ if (parsed.success) return { ok: true, args: parsed.data as Record<string, unknown> };
220
+ const message = new McpError(
221
+ ErrorCode.InvalidParams,
222
+ `Input validation error: Invalid arguments for tool ${aliasName}: ${parsed.error.message}`,
223
+ ).message;
224
+ return { ok: false, message };
225
+ };
226
+
227
+ // Renamed tools (aliases) are never registered with McpServer: the transport
228
+ // rewrites an alias call onto its target before the SDK sees it, and handlers
229
+ // read the called name back through getCallInfo(extra.requestId).
230
+ const transport = new AliasTransport(
231
+ new StdioServerTransport(),
232
+ registry,
233
+ toolsets.all ? null : visibleTools(registry, toolsets.enabled, 'stdio'),
234
+ legacyValidator,
235
+ );
236
+
237
+ // Preview then confirm tokens: a random key and an in-memory one-time-use
238
+ // set per process (UX protection only; REST authorization is unchanged).
239
+ const previews = new StdioPreviewTokens();
240
+
241
+ function registerAll(tools: ToolModule[]): void {
242
+ for (const tool of tools) {
243
+ server.tool(
244
+ tool.name,
245
+ tool.description,
246
+ tool.inputSchema.shape,
247
+ getToolAnnotations(tool.name),
248
+ async (input, extra) => {
249
+ // The CALLED name (an alias, or the tool itself) is what telemetry
250
+ // records as X-Posterly-Tool. The per-call context lives only here:
251
+ // never in the arguments, never on shared state.
252
+ const callInfo = transport.getCallInfo(extra.requestId);
253
+ const calledName = callInfo?.calledName ?? tool.name;
254
+ const ctx: ToolContext = {
255
+ calledName,
256
+ legacyConfirm: callInfo?.legacyConfirm === true,
257
+ registry,
258
+ previews,
259
+ toolsets: { enabled: toolsets.enabled, all: toolsets.all },
260
+ };
261
+ try {
262
+ const text = await client.runToolCall(calledName, () => tool.execute(client, input, ctx));
263
+ return { content: [{ type: 'text' as const, text }] };
264
+ } catch (err: any) {
265
+ return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
266
+ }
267
+ },
268
+ );
1471
269
  }
1472
- );
270
+ }
1473
271
 
1474
- server.tool(
1475
- getXPostingQuotaTool.name,
1476
- getXPostingQuotaTool.description,
1477
- getXPostingQuotaTool.inputSchema.shape,
1478
- getToolAnnotations(getXPostingQuotaTool.name),
1479
- async (input) => {
1480
- try {
1481
- const text = await getXPostingQuotaTool.execute(client, input as any);
1482
- return { content: [{ type: 'text' as const, text }] };
1483
- } catch (err: any) {
1484
- return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
1485
- }
1486
- }
1487
- );
272
+ registerAll(STDIO_TOOLS);
1488
273
 
1489
274
  // Start the server
1490
275
  async function main() {
1491
- const transport = new StdioServerTransport();
1492
276
  await server.connect(transport);
1493
277
  }
1494
278