posterly-mcp-server 0.19.7 → 0.19.8

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 (135) hide show
  1. package/README.md +26 -30
  2. package/dist/generated/platform-manifest.d.ts +1 -1
  3. package/dist/generated/platform-manifest.js +2 -1
  4. package/dist/index.js +74 -56
  5. package/dist/lib/api-client.d.ts +30 -6
  6. package/dist/lib/api-client.js +3 -1
  7. package/dist/lib/format.d.ts +21 -11
  8. package/dist/lib/format.js +111 -37
  9. package/dist/tools/audit-google-business-profile.js +15 -12
  10. package/dist/tools/create-connect-session.d.ts +2 -6
  11. package/dist/tools/create-connect-session.js +17 -24
  12. package/dist/tools/create-oauth-client.js +7 -1
  13. package/dist/tools/create-post.d.ts +43 -43
  14. package/dist/tools/create-post.js +20 -31
  15. package/dist/tools/create-posts-batch.d.ts +33 -33
  16. package/dist/tools/create-posts-batch.js +23 -21
  17. package/dist/tools/create-signed-upload.js +10 -7
  18. package/dist/tools/create-webhook.js +7 -2
  19. package/dist/tools/delete-google-business-review-reply.d.ts +1 -1
  20. package/dist/tools/delete-google-business-review-reply.js +4 -1
  21. package/dist/tools/delete-oauth-client.js +4 -1
  22. package/dist/tools/delete-post-group.js +5 -1
  23. package/dist/tools/delete-post.js +4 -8
  24. package/dist/tools/delete-webhook.js +4 -1
  25. package/dist/tools/disconnect-account.js +7 -5
  26. package/dist/tools/find-slot.js +10 -3
  27. package/dist/tools/generate-captions.d.ts +76 -0
  28. package/dist/tools/generate-captions.js +69 -0
  29. package/dist/tools/generate-image.d.ts +2 -2
  30. package/dist/tools/generate-image.js +17 -19
  31. package/dist/tools/generate-video.js +11 -9
  32. package/dist/tools/get-account-analytics.d.ts +0 -7
  33. package/dist/tools/get-account-analytics.js +54 -116
  34. package/dist/tools/get-brand-profile.js +34 -40
  35. package/dist/tools/get-brand.js +14 -16
  36. package/dist/tools/get-connect-link.d.ts +2 -6
  37. package/dist/tools/get-connect-link.js +28 -14
  38. package/dist/tools/get-connect-session.d.ts +0 -4
  39. package/dist/tools/get-connect-session.js +15 -41
  40. package/dist/tools/get-google-business-review-link.js +6 -6
  41. package/dist/tools/get-platform-schema.d.ts +2 -2
  42. package/dist/tools/get-platform-schema.js +23 -16
  43. package/dist/tools/get-post-analytics.d.ts +0 -7
  44. package/dist/tools/get-post-analytics.js +40 -116
  45. package/dist/tools/get-post-missing.js +5 -1
  46. package/dist/tools/get-post.js +16 -16
  47. package/dist/tools/get-video-job.d.ts +2 -2
  48. package/dist/tools/get-video-job.js +28 -11
  49. package/dist/tools/get-video-options.js +21 -15
  50. package/dist/tools/get-x-posting-quota.js +12 -9
  51. package/dist/tools/list-accounts.js +12 -4
  52. package/dist/tools/list-activity.js +13 -18
  53. package/dist/tools/list-brand-accounts.js +11 -3
  54. package/dist/tools/list-brands.js +12 -11
  55. package/dist/tools/list-google-business-reviews.js +13 -11
  56. package/dist/tools/list-oauth-clients.js +10 -4
  57. package/dist/tools/list-platforms.js +12 -5
  58. package/dist/tools/list-posts.d.ts +2 -2
  59. package/dist/tools/list-posts.js +11 -13
  60. package/dist/tools/list-webhooks.js +13 -11
  61. package/dist/tools/reply-google-business-review.d.ts +1 -1
  62. package/dist/tools/reply-google-business-review.js +4 -1
  63. package/dist/tools/run-video-function.js +4 -4
  64. package/dist/tools/suggest-google-business-review-reply.d.ts +2 -2
  65. package/dist/tools/suggest-google-business-review-reply.js +5 -4
  66. package/dist/tools/test-webhook.js +7 -1
  67. package/dist/tools/trigger-platform-helper.d.ts +2 -2
  68. package/dist/tools/trigger-platform-helper.js +5 -1
  69. package/dist/tools/update-oauth-client.js +8 -1
  70. package/dist/tools/update-post-release-id.js +5 -1
  71. package/dist/tools/update-post-status.d.ts +2 -2
  72. package/dist/tools/update-post-status.js +7 -1
  73. package/dist/tools/update-post.d.ts +20 -20
  74. package/dist/tools/update-post.js +10 -4
  75. package/dist/tools/update-webhook.js +7 -1
  76. package/dist/tools/upload-media-from-url.js +7 -9
  77. package/dist/tools/upload-media.js +6 -2
  78. package/dist/tools/whoami.js +18 -17
  79. package/package.json +1 -1
  80. package/src/generated/platform-manifest.ts +2 -1
  81. package/src/index.ts +79 -56
  82. package/src/lib/api-client.ts +45 -3
  83. package/src/lib/format.ts +111 -35
  84. package/src/tools/audit-google-business-profile.ts +18 -12
  85. package/src/tools/create-connect-session.ts +18 -25
  86. package/src/tools/create-oauth-client.ts +8 -2
  87. package/src/tools/create-post.ts +20 -35
  88. package/src/tools/create-posts-batch.ts +23 -28
  89. package/src/tools/create-signed-upload.ts +10 -7
  90. package/src/tools/create-webhook.ts +7 -3
  91. package/src/tools/delete-google-business-review-reply.ts +4 -1
  92. package/src/tools/delete-oauth-client.ts +4 -1
  93. package/src/tools/delete-post-group.ts +5 -1
  94. package/src/tools/delete-post.ts +4 -8
  95. package/src/tools/delete-webhook.ts +4 -2
  96. package/src/tools/disconnect-account.ts +7 -5
  97. package/src/tools/find-slot.ts +13 -5
  98. package/src/tools/generate-captions.ts +77 -0
  99. package/src/tools/generate-image.ts +20 -20
  100. package/src/tools/generate-video.ts +11 -9
  101. package/src/tools/get-account-analytics.ts +60 -123
  102. package/src/tools/get-brand-profile.ts +34 -38
  103. package/src/tools/get-brand.ts +14 -14
  104. package/src/tools/get-connect-link.ts +32 -15
  105. package/src/tools/get-connect-session.ts +16 -43
  106. package/src/tools/get-google-business-review-link.ts +6 -6
  107. package/src/tools/get-platform-schema.ts +29 -16
  108. package/src/tools/get-post-analytics.ts +55 -130
  109. package/src/tools/get-post-missing.ts +5 -2
  110. package/src/tools/get-post.ts +16 -15
  111. package/src/tools/get-video-job.ts +31 -11
  112. package/src/tools/get-video-options.ts +27 -15
  113. package/src/tools/get-x-posting-quota.ts +12 -9
  114. package/src/tools/list-accounts.ts +15 -6
  115. package/src/tools/list-activity.ts +16 -20
  116. package/src/tools/list-brand-accounts.ts +14 -6
  117. package/src/tools/list-brands.ts +16 -13
  118. package/src/tools/list-google-business-reviews.ts +16 -12
  119. package/src/tools/list-oauth-clients.ts +13 -4
  120. package/src/tools/list-platforms.ts +15 -5
  121. package/src/tools/list-posts.ts +14 -14
  122. package/src/tools/list-webhooks.ts +16 -12
  123. package/src/tools/reply-google-business-review.ts +4 -1
  124. package/src/tools/run-video-function.ts +4 -4
  125. package/src/tools/suggest-google-business-review-reply.ts +5 -4
  126. package/src/tools/test-webhook.ts +7 -1
  127. package/src/tools/trigger-platform-helper.ts +5 -1
  128. package/src/tools/update-oauth-client.ts +9 -2
  129. package/src/tools/update-post-release-id.ts +5 -2
  130. package/src/tools/update-post-status.ts +7 -1
  131. package/src/tools/update-post.ts +10 -5
  132. package/src/tools/update-webhook.ts +7 -2
  133. package/src/tools/upload-media-from-url.ts +7 -9
  134. package/src/tools/upload-media.ts +6 -2
  135. package/src/tools/whoami.ts +21 -23
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { mdError } from './lib/format.js';
4
5
  import { PosterlyClient } from './lib/api-client.js';
5
6
  import { getAgentSignupInfoTool } from './tools/get-agent-signup-info.js';
6
7
  import { getSignupSessionTool } from './tools/get-signup-session.js';
@@ -24,6 +25,7 @@ import { updatePostReleaseIdTool } from './tools/update-post-release-id.js';
24
25
  import { deletePostTool } from './tools/delete-post.js';
25
26
  import { deletePostGroupTool } from './tools/delete-post-group.js';
26
27
  import { whoamiTool } from './tools/whoami.js';
28
+ import { generateCaptionsTool } from './tools/generate-captions.js';
27
29
  import { generateImageTool } from './tools/generate-image.js';
28
30
  import { getVideoOptionsTool } from './tools/get-video-options.js';
29
31
  import { runVideoFunctionTool } from './tools/run-video-function.js';
@@ -58,9 +60,16 @@ import { updateOAuthClientTool } from './tools/update-oauth-client.js';
58
60
  import { deleteOAuthClientTool } from './tools/delete-oauth-client.js';
59
61
  const server = new McpServer({
60
62
  name: 'posterly',
61
- version: '0.19.7',
63
+ version: '0.19.8',
62
64
  });
63
- const client = new PosterlyClient();
65
+ let client;
66
+ try {
67
+ client = new PosterlyClient();
68
+ }
69
+ catch (err) {
70
+ console.error(err.message);
71
+ process.exit(1);
72
+ }
64
73
  // Register tools
65
74
  server.tool(getAgentSignupInfoTool.name, getAgentSignupInfoTool.description, getAgentSignupInfoTool.inputSchema.shape, async () => {
66
75
  try {
@@ -68,7 +77,7 @@ server.tool(getAgentSignupInfoTool.name, getAgentSignupInfoTool.description, get
68
77
  return { content: [{ type: 'text', text }] };
69
78
  }
70
79
  catch (err) {
71
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
80
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
72
81
  }
73
82
  });
74
83
  server.tool(startSignupTool.name, startSignupTool.description, startSignupTool.inputSchema.shape, async (input) => {
@@ -77,7 +86,7 @@ server.tool(startSignupTool.name, startSignupTool.description, startSignupTool.i
77
86
  return { content: [{ type: 'text', text }] };
78
87
  }
79
88
  catch (err) {
80
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
89
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
81
90
  }
82
91
  });
83
92
  server.tool(getSignupSessionTool.name, getSignupSessionTool.description, getSignupSessionTool.inputSchema.shape, async (input) => {
@@ -86,7 +95,7 @@ server.tool(getSignupSessionTool.name, getSignupSessionTool.description, getSign
86
95
  return { content: [{ type: 'text', text }] };
87
96
  }
88
97
  catch (err) {
89
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
98
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
90
99
  }
91
100
  });
92
101
  server.tool(whoamiTool.name, whoamiTool.description, whoamiTool.inputSchema.shape, async () => {
@@ -95,7 +104,7 @@ server.tool(whoamiTool.name, whoamiTool.description, whoamiTool.inputSchema.shap
95
104
  return { content: [{ type: 'text', text }] };
96
105
  }
97
106
  catch (err) {
98
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
107
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
99
108
  }
100
109
  });
101
110
  server.tool(listAccountsTool.name, listAccountsTool.description, listAccountsTool.inputSchema.shape, async (input) => {
@@ -104,7 +113,7 @@ server.tool(listAccountsTool.name, listAccountsTool.description, listAccountsToo
104
113
  return { content: [{ type: 'text', text }] };
105
114
  }
106
115
  catch (err) {
107
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
116
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
108
117
  }
109
118
  });
110
119
  server.tool(disconnectAccountTool.name, disconnectAccountTool.description, disconnectAccountTool.inputSchema.shape, async (input) => {
@@ -113,7 +122,7 @@ server.tool(disconnectAccountTool.name, disconnectAccountTool.description, disco
113
122
  return { content: [{ type: 'text', text }] };
114
123
  }
115
124
  catch (err) {
116
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
125
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
117
126
  }
118
127
  });
119
128
  server.tool(getConnectLinkTool.name, getConnectLinkTool.description, getConnectLinkTool.inputSchema.shape, async (input) => {
@@ -122,7 +131,7 @@ server.tool(getConnectLinkTool.name, getConnectLinkTool.description, getConnectL
122
131
  return { content: [{ type: 'text', text }] };
123
132
  }
124
133
  catch (err) {
125
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
134
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
126
135
  }
127
136
  });
128
137
  server.tool(createConnectSessionTool.name, createConnectSessionTool.description, createConnectSessionTool.inputSchema.shape, async (input) => {
@@ -131,7 +140,7 @@ server.tool(createConnectSessionTool.name, createConnectSessionTool.description,
131
140
  return { content: [{ type: 'text', text }] };
132
141
  }
133
142
  catch (err) {
134
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
143
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
135
144
  }
136
145
  });
137
146
  server.tool(getConnectSessionTool.name, getConnectSessionTool.description, getConnectSessionTool.inputSchema.shape, async (input) => {
@@ -140,7 +149,7 @@ server.tool(getConnectSessionTool.name, getConnectSessionTool.description, getCo
140
149
  return { content: [{ type: 'text', text }] };
141
150
  }
142
151
  catch (err) {
143
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
152
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
144
153
  }
145
154
  });
146
155
  server.tool(listOAuthClientsTool.name, listOAuthClientsTool.description, listOAuthClientsTool.inputSchema.shape, async () => {
@@ -149,7 +158,7 @@ server.tool(listOAuthClientsTool.name, listOAuthClientsTool.description, listOAu
149
158
  return { content: [{ type: 'text', text }] };
150
159
  }
151
160
  catch (err) {
152
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
161
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
153
162
  }
154
163
  });
155
164
  server.tool(createOAuthClientTool.name, createOAuthClientTool.description, createOAuthClientTool.inputSchema.shape, async (input) => {
@@ -158,7 +167,7 @@ server.tool(createOAuthClientTool.name, createOAuthClientTool.description, creat
158
167
  return { content: [{ type: 'text', text }] };
159
168
  }
160
169
  catch (err) {
161
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
170
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
162
171
  }
163
172
  });
164
173
  server.tool(updateOAuthClientTool.name, updateOAuthClientTool.description, updateOAuthClientTool.inputSchema.shape, async (input) => {
@@ -167,7 +176,7 @@ server.tool(updateOAuthClientTool.name, updateOAuthClientTool.description, updat
167
176
  return { content: [{ type: 'text', text }] };
168
177
  }
169
178
  catch (err) {
170
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
179
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
171
180
  }
172
181
  });
173
182
  server.tool(deleteOAuthClientTool.name, deleteOAuthClientTool.description, deleteOAuthClientTool.inputSchema.shape, async (input) => {
@@ -176,7 +185,7 @@ server.tool(deleteOAuthClientTool.name, deleteOAuthClientTool.description, delet
176
185
  return { content: [{ type: 'text', text }] };
177
186
  }
178
187
  catch (err) {
179
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
188
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
180
189
  }
181
190
  });
182
191
  server.tool(listPlatformsTool.name, listPlatformsTool.description, listPlatformsTool.inputSchema.shape, async (input) => {
@@ -185,7 +194,7 @@ server.tool(listPlatformsTool.name, listPlatformsTool.description, listPlatforms
185
194
  return { content: [{ type: 'text', text }] };
186
195
  }
187
196
  catch (err) {
188
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
197
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
189
198
  }
190
199
  });
191
200
  server.tool(getPlatformSchemaTool.name, getPlatformSchemaTool.description, getPlatformSchemaTool.inputSchema.shape, async (input) => {
@@ -194,7 +203,7 @@ server.tool(getPlatformSchemaTool.name, getPlatformSchemaTool.description, getPl
194
203
  return { content: [{ type: 'text', text }] };
195
204
  }
196
205
  catch (err) {
197
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
206
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
198
207
  }
199
208
  });
200
209
  server.tool(triggerPlatformHelperTool.name, triggerPlatformHelperTool.description, triggerPlatformHelperTool.inputSchema.shape, async (input) => {
@@ -203,7 +212,7 @@ server.tool(triggerPlatformHelperTool.name, triggerPlatformHelperTool.descriptio
203
212
  return { content: [{ type: 'text', text }] };
204
213
  }
205
214
  catch (err) {
206
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
215
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
207
216
  }
208
217
  });
209
218
  server.tool(listBrandsTool.name, listBrandsTool.description, listBrandsTool.inputSchema.shape, async (input) => {
@@ -212,7 +221,7 @@ server.tool(listBrandsTool.name, listBrandsTool.description, listBrandsTool.inpu
212
221
  return { content: [{ type: 'text', text }] };
213
222
  }
214
223
  catch (err) {
215
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
224
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
216
225
  }
217
226
  });
218
227
  server.tool(getBrandTool.name, getBrandTool.description, getBrandTool.inputSchema.shape, async (input) => {
@@ -221,7 +230,7 @@ server.tool(getBrandTool.name, getBrandTool.description, getBrandTool.inputSchem
221
230
  return { content: [{ type: 'text', text }] };
222
231
  }
223
232
  catch (err) {
224
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
233
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
225
234
  }
226
235
  });
227
236
  server.tool(listBrandAccountsTool.name, listBrandAccountsTool.description, listBrandAccountsTool.inputSchema.shape, async (input) => {
@@ -230,7 +239,7 @@ server.tool(listBrandAccountsTool.name, listBrandAccountsTool.description, listB
230
239
  return { content: [{ type: 'text', text }] };
231
240
  }
232
241
  catch (err) {
233
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
242
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
234
243
  }
235
244
  });
236
245
  server.tool(getBrandProfileTool.name, getBrandProfileTool.description, getBrandProfileTool.inputSchema.shape, async (input) => {
@@ -239,7 +248,7 @@ server.tool(getBrandProfileTool.name, getBrandProfileTool.description, getBrandP
239
248
  return { content: [{ type: 'text', text }] };
240
249
  }
241
250
  catch (err) {
242
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
251
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
243
252
  }
244
253
  });
245
254
  server.tool(createPostTool.name, createPostTool.description, createPostTool.inputSchema.shape, async (input) => {
@@ -248,7 +257,7 @@ server.tool(createPostTool.name, createPostTool.description, createPostTool.inpu
248
257
  return { content: [{ type: 'text', text }] };
249
258
  }
250
259
  catch (err) {
251
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
260
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
252
261
  }
253
262
  });
254
263
  server.tool(createPostsBatchTool.name, createPostsBatchTool.description, createPostsBatchTool.inputSchema.shape, async (input) => {
@@ -257,7 +266,7 @@ server.tool(createPostsBatchTool.name, createPostsBatchTool.description, createP
257
266
  return { content: [{ type: 'text', text }] };
258
267
  }
259
268
  catch (err) {
260
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
269
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
261
270
  }
262
271
  });
263
272
  server.tool(findSlotTool.name, findSlotTool.description, findSlotTool.inputSchema.shape, async (input) => {
@@ -266,7 +275,7 @@ server.tool(findSlotTool.name, findSlotTool.description, findSlotTool.inputSchem
266
275
  return { content: [{ type: 'text', text }] };
267
276
  }
268
277
  catch (err) {
269
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
278
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
270
279
  }
271
280
  });
272
281
  server.tool(listPostsTool.name, listPostsTool.description, listPostsTool.inputSchema.shape, async (input) => {
@@ -275,7 +284,7 @@ server.tool(listPostsTool.name, listPostsTool.description, listPostsTool.inputSc
275
284
  return { content: [{ type: 'text', text }] };
276
285
  }
277
286
  catch (err) {
278
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
287
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
279
288
  }
280
289
  });
281
290
  server.tool(uploadMediaTool.name, uploadMediaTool.description, uploadMediaTool.inputSchema.shape, async (input) => {
@@ -284,7 +293,7 @@ server.tool(uploadMediaTool.name, uploadMediaTool.description, uploadMediaTool.i
284
293
  return { content: [{ type: 'text', text }] };
285
294
  }
286
295
  catch (err) {
287
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
296
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
288
297
  }
289
298
  });
290
299
  server.tool(uploadMediaFromUrlTool.name, uploadMediaFromUrlTool.description, uploadMediaFromUrlTool.inputSchema.shape, async (input) => {
@@ -293,7 +302,7 @@ server.tool(uploadMediaFromUrlTool.name, uploadMediaFromUrlTool.description, upl
293
302
  return { content: [{ type: 'text', text }] };
294
303
  }
295
304
  catch (err) {
296
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
305
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
297
306
  }
298
307
  });
299
308
  server.tool(createSignedUploadTool.name, createSignedUploadTool.description, createSignedUploadTool.inputSchema.shape, async (input) => {
@@ -302,7 +311,16 @@ server.tool(createSignedUploadTool.name, createSignedUploadTool.description, cre
302
311
  return { content: [{ type: 'text', text }] };
303
312
  }
304
313
  catch (err) {
305
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
314
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
315
+ }
316
+ });
317
+ server.tool(generateCaptionsTool.name, generateCaptionsTool.description, generateCaptionsTool.inputSchema.shape, async (input) => {
318
+ try {
319
+ const text = await generateCaptionsTool.execute(client, input);
320
+ return { content: [{ type: 'text', text }] };
321
+ }
322
+ catch (err) {
323
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
306
324
  }
307
325
  });
308
326
  server.tool(getVideoOptionsTool.name, getVideoOptionsTool.description, getVideoOptionsTool.inputSchema.shape, async () => {
@@ -311,7 +329,7 @@ server.tool(getVideoOptionsTool.name, getVideoOptionsTool.description, getVideoO
311
329
  return { content: [{ type: 'text', text }] };
312
330
  }
313
331
  catch (err) {
314
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
332
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
315
333
  }
316
334
  });
317
335
  server.tool(runVideoFunctionTool.name, runVideoFunctionTool.description, runVideoFunctionTool.inputSchema.shape, async (input) => {
@@ -320,7 +338,7 @@ server.tool(runVideoFunctionTool.name, runVideoFunctionTool.description, runVide
320
338
  return { content: [{ type: 'text', text }] };
321
339
  }
322
340
  catch (err) {
323
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
341
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
324
342
  }
325
343
  });
326
344
  server.tool(generateVideoTool.name, generateVideoTool.description, generateVideoTool.inputSchema.shape, async (input) => {
@@ -329,7 +347,7 @@ server.tool(generateVideoTool.name, generateVideoTool.description, generateVideo
329
347
  return { content: [{ type: 'text', text }] };
330
348
  }
331
349
  catch (err) {
332
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
350
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
333
351
  }
334
352
  });
335
353
  server.tool(getVideoJobTool.name, getVideoJobTool.description, getVideoJobTool.inputSchema.shape, async (input) => {
@@ -338,7 +356,7 @@ server.tool(getVideoJobTool.name, getVideoJobTool.description, getVideoJobTool.i
338
356
  return { content: [{ type: 'text', text }] };
339
357
  }
340
358
  catch (err) {
341
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
359
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
342
360
  }
343
361
  });
344
362
  server.tool(generateImageTool.name, generateImageTool.description, generateImageTool.inputSchema.shape, async (input) => {
@@ -347,7 +365,7 @@ server.tool(generateImageTool.name, generateImageTool.description, generateImage
347
365
  return { content: [{ type: 'text', text }] };
348
366
  }
349
367
  catch (err) {
350
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
368
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
351
369
  }
352
370
  });
353
371
  server.tool(getPostTool.name, getPostTool.description, getPostTool.inputSchema.shape, async (input) => {
@@ -356,7 +374,7 @@ server.tool(getPostTool.name, getPostTool.description, getPostTool.inputSchema.s
356
374
  return { content: [{ type: 'text', text }] };
357
375
  }
358
376
  catch (err) {
359
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
377
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
360
378
  }
361
379
  });
362
380
  server.tool(getPostMissingTool.name, getPostMissingTool.description, getPostMissingTool.inputSchema.shape, async (input) => {
@@ -365,7 +383,7 @@ server.tool(getPostMissingTool.name, getPostMissingTool.description, getPostMiss
365
383
  return { content: [{ type: 'text', text }] };
366
384
  }
367
385
  catch (err) {
368
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
386
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
369
387
  }
370
388
  });
371
389
  server.tool(updatePostTool.name, updatePostTool.description, updatePostTool.inputSchema.shape, async (input) => {
@@ -374,7 +392,7 @@ server.tool(updatePostTool.name, updatePostTool.description, updatePostTool.inpu
374
392
  return { content: [{ type: 'text', text }] };
375
393
  }
376
394
  catch (err) {
377
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
395
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
378
396
  }
379
397
  });
380
398
  server.tool(updatePostStatusTool.name, updatePostStatusTool.description, updatePostStatusTool.inputSchema.shape, async (input) => {
@@ -383,7 +401,7 @@ server.tool(updatePostStatusTool.name, updatePostStatusTool.description, updateP
383
401
  return { content: [{ type: 'text', text }] };
384
402
  }
385
403
  catch (err) {
386
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
404
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
387
405
  }
388
406
  });
389
407
  server.tool(updatePostReleaseIdTool.name, updatePostReleaseIdTool.description, updatePostReleaseIdTool.inputSchema.shape, async (input) => {
@@ -392,7 +410,7 @@ server.tool(updatePostReleaseIdTool.name, updatePostReleaseIdTool.description, u
392
410
  return { content: [{ type: 'text', text }] };
393
411
  }
394
412
  catch (err) {
395
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
413
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
396
414
  }
397
415
  });
398
416
  server.tool(deletePostTool.name, deletePostTool.description, deletePostTool.inputSchema.shape, async (input) => {
@@ -401,7 +419,7 @@ server.tool(deletePostTool.name, deletePostTool.description, deletePostTool.inpu
401
419
  return { content: [{ type: 'text', text }] };
402
420
  }
403
421
  catch (err) {
404
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
422
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
405
423
  }
406
424
  });
407
425
  server.tool(deletePostGroupTool.name, deletePostGroupTool.description, deletePostGroupTool.inputSchema.shape, async (input) => {
@@ -410,7 +428,7 @@ server.tool(deletePostGroupTool.name, deletePostGroupTool.description, deletePos
410
428
  return { content: [{ type: 'text', text }] };
411
429
  }
412
430
  catch (err) {
413
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
431
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
414
432
  }
415
433
  });
416
434
  server.tool(getAccountAnalyticsTool.name, getAccountAnalyticsTool.description, getAccountAnalyticsTool.inputSchema.shape, async (input) => {
@@ -419,7 +437,7 @@ server.tool(getAccountAnalyticsTool.name, getAccountAnalyticsTool.description, g
419
437
  return { content: [{ type: 'text', text }] };
420
438
  }
421
439
  catch (err) {
422
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
440
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
423
441
  }
424
442
  });
425
443
  server.tool(getPostAnalyticsTool.name, getPostAnalyticsTool.description, getPostAnalyticsTool.inputSchema.shape, async (input) => {
@@ -428,7 +446,7 @@ server.tool(getPostAnalyticsTool.name, getPostAnalyticsTool.description, getPost
428
446
  return { content: [{ type: 'text', text }] };
429
447
  }
430
448
  catch (err) {
431
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
449
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
432
450
  }
433
451
  });
434
452
  server.tool(listGoogleBusinessReviewsTool.name, listGoogleBusinessReviewsTool.description, listGoogleBusinessReviewsTool.inputSchema.shape, async (input) => {
@@ -437,7 +455,7 @@ server.tool(listGoogleBusinessReviewsTool.name, listGoogleBusinessReviewsTool.de
437
455
  return { content: [{ type: 'text', text }] };
438
456
  }
439
457
  catch (err) {
440
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
458
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
441
459
  }
442
460
  });
443
461
  server.tool(getGoogleBusinessReviewLinkTool.name, getGoogleBusinessReviewLinkTool.description, getGoogleBusinessReviewLinkTool.inputSchema.shape, async (input) => {
@@ -446,7 +464,7 @@ server.tool(getGoogleBusinessReviewLinkTool.name, getGoogleBusinessReviewLinkToo
446
464
  return { content: [{ type: 'text', text }] };
447
465
  }
448
466
  catch (err) {
449
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
467
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
450
468
  }
451
469
  });
452
470
  server.tool(auditGoogleBusinessProfileTool.name, auditGoogleBusinessProfileTool.description, auditGoogleBusinessProfileTool.inputSchema.shape, async (input) => {
@@ -455,7 +473,7 @@ server.tool(auditGoogleBusinessProfileTool.name, auditGoogleBusinessProfileTool.
455
473
  return { content: [{ type: 'text', text }] };
456
474
  }
457
475
  catch (err) {
458
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
476
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
459
477
  }
460
478
  });
461
479
  server.tool(suggestGoogleBusinessReviewReplyTool.name, suggestGoogleBusinessReviewReplyTool.description, suggestGoogleBusinessReviewReplyTool.inputSchema.shape, async (input) => {
@@ -464,7 +482,7 @@ server.tool(suggestGoogleBusinessReviewReplyTool.name, suggestGoogleBusinessRevi
464
482
  return { content: [{ type: 'text', text }] };
465
483
  }
466
484
  catch (err) {
467
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
485
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
468
486
  }
469
487
  });
470
488
  server.tool(replyGoogleBusinessReviewTool.name, replyGoogleBusinessReviewTool.description, replyGoogleBusinessReviewTool.inputSchema.shape, async (input) => {
@@ -473,7 +491,7 @@ server.tool(replyGoogleBusinessReviewTool.name, replyGoogleBusinessReviewTool.de
473
491
  return { content: [{ type: 'text', text }] };
474
492
  }
475
493
  catch (err) {
476
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
494
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
477
495
  }
478
496
  });
479
497
  server.tool(deleteGoogleBusinessReviewReplyTool.name, deleteGoogleBusinessReviewReplyTool.description, deleteGoogleBusinessReviewReplyTool.inputSchema.shape, async (input) => {
@@ -482,7 +500,7 @@ server.tool(deleteGoogleBusinessReviewReplyTool.name, deleteGoogleBusinessReview
482
500
  return { content: [{ type: 'text', text }] };
483
501
  }
484
502
  catch (err) {
485
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
503
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
486
504
  }
487
505
  });
488
506
  server.tool(listActivityTool.name, listActivityTool.description, listActivityTool.inputSchema.shape, async (input) => {
@@ -491,7 +509,7 @@ server.tool(listActivityTool.name, listActivityTool.description, listActivityToo
491
509
  return { content: [{ type: 'text', text }] };
492
510
  }
493
511
  catch (err) {
494
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
512
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
495
513
  }
496
514
  });
497
515
  server.tool(listWebhooksTool.name, listWebhooksTool.description, listWebhooksTool.inputSchema.shape, async (input) => {
@@ -500,7 +518,7 @@ server.tool(listWebhooksTool.name, listWebhooksTool.description, listWebhooksToo
500
518
  return { content: [{ type: 'text', text }] };
501
519
  }
502
520
  catch (err) {
503
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
521
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
504
522
  }
505
523
  });
506
524
  server.tool(createWebhookTool.name, createWebhookTool.description, createWebhookTool.inputSchema.shape, async (input) => {
@@ -509,7 +527,7 @@ server.tool(createWebhookTool.name, createWebhookTool.description, createWebhook
509
527
  return { content: [{ type: 'text', text }] };
510
528
  }
511
529
  catch (err) {
512
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
530
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
513
531
  }
514
532
  });
515
533
  server.tool(updateWebhookTool.name, updateWebhookTool.description, updateWebhookTool.inputSchema.shape, async (input) => {
@@ -518,7 +536,7 @@ server.tool(updateWebhookTool.name, updateWebhookTool.description, updateWebhook
518
536
  return { content: [{ type: 'text', text }] };
519
537
  }
520
538
  catch (err) {
521
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
539
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
522
540
  }
523
541
  });
524
542
  server.tool(deleteWebhookTool.name, deleteWebhookTool.description, deleteWebhookTool.inputSchema.shape, async (input) => {
@@ -527,7 +545,7 @@ server.tool(deleteWebhookTool.name, deleteWebhookTool.description, deleteWebhook
527
545
  return { content: [{ type: 'text', text }] };
528
546
  }
529
547
  catch (err) {
530
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
548
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
531
549
  }
532
550
  });
533
551
  server.tool(testWebhookTool.name, testWebhookTool.description, testWebhookTool.inputSchema.shape, async (input) => {
@@ -536,7 +554,7 @@ server.tool(testWebhookTool.name, testWebhookTool.description, testWebhookTool.i
536
554
  return { content: [{ type: 'text', text }] };
537
555
  }
538
556
  catch (err) {
539
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
557
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
540
558
  }
541
559
  });
542
560
  server.tool(getXPostingQuotaTool.name, getXPostingQuotaTool.description, getXPostingQuotaTool.inputSchema.shape, async (input) => {
@@ -545,7 +563,7 @@ server.tool(getXPostingQuotaTool.name, getXPostingQuotaTool.description, getXPos
545
563
  return { content: [{ type: 'text', text }] };
546
564
  }
547
565
  catch (err) {
548
- return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
566
+ return { content: [{ type: 'text', text: mdError(err.message) }], isError: true };
549
567
  }
550
568
  });
551
569
  // Start the server
@@ -120,6 +120,35 @@ export type BatchCreatePostsResponse = {
120
120
  replayed: number;
121
121
  failed: number;
122
122
  };
123
+ export type CaptionPlatform = 'instagram' | 'facebook' | 'tiktok' | 'twitter' | 'threads' | 'linkedin' | 'youtube' | 'pinterest' | 'google_business';
124
+ export type GenerateCaptionsPayload = {
125
+ platforms: CaptionPlatform[];
126
+ brief?: string;
127
+ tone?: string;
128
+ allow_emojis?: boolean;
129
+ hashtag_strategy?: 'none' | 'smart' | 'minimal' | 'aggressive';
130
+ count?: number;
131
+ mode?: 'generate' | 'adapt';
132
+ source_caption?: string;
133
+ source_platform?: CaptionPlatform;
134
+ preserve_links?: boolean;
135
+ preserve_mentions?: boolean;
136
+ preserve_call_to_action?: boolean;
137
+ social_account_id?: string;
138
+ workspace_id?: string;
139
+ manual_brand_voice?: {
140
+ summary: string;
141
+ traits?: string[];
142
+ style_guidelines?: string[];
143
+ };
144
+ };
145
+ export type GenerateCaptionsResponse = {
146
+ success: boolean;
147
+ suggestions: Record<string, string[]>;
148
+ workspace_id?: string | null;
149
+ social_account_id?: number | null;
150
+ usage?: Record<string, unknown>;
151
+ };
123
152
  export interface Slot {
124
153
  time: string;
125
154
  local_time: string;
@@ -164,12 +193,6 @@ export interface AccountAnalyticsSummary {
164
193
  total_watch_minutes?: number | null;
165
194
  total_likes?: number | null;
166
195
  platform_metrics?: Record<string, number | null | undefined>;
167
- display_metrics?: Array<{
168
- key?: string;
169
- label: string;
170
- value: number | null | undefined;
171
- unit?: string;
172
- }>;
173
196
  }
174
197
  export interface AccountAnalyticsSnapshot {
175
198
  date: string;
@@ -552,6 +575,7 @@ export declare class PosterlyClient {
552
575
  createPostsBatch(data: {
553
576
  posts: CreatePostPayload[];
554
577
  }): Promise<BatchCreatePostsResponse>;
578
+ generateCaptions(data: GenerateCaptionsPayload): Promise<GenerateCaptionsResponse>;
555
579
  getPost(id: number): Promise<{
556
580
  post: Post;
557
581
  }>;
@@ -143,6 +143,9 @@ export class PosterlyClient {
143
143
  async createPostsBatch(data) {
144
144
  return this.request('POST', '/posts/batch', data);
145
145
  }
146
+ async generateCaptions(data) {
147
+ return this.request('POST', '/ai/generate-captions', data);
148
+ }
146
149
  async getPost(id) {
147
150
  return this.request('GET', `/posts/${id}`);
148
151
  }
@@ -338,7 +341,6 @@ export class PosterlyClient {
338
341
  });
339
342
  }
340
343
  async uploadMedia(input) {
341
- this.requireApiKey();
342
344
  let fileBuffer;
343
345
  if (input.filePath) {
344
346
  fileBuffer = await readFile(resolve(input.filePath));
@@ -1,11 +1,21 @@
1
- import type { Account, Post } from './api-client.js';
2
- export declare const DASHBOARD_CALENDAR_URL: string;
3
- export declare const DASHBOARD_TABLE_URL: string;
4
- export declare const DASHBOARD_CONNECT_URL: string;
5
- export declare function formatLocalDateTime(value?: string | null): string;
6
- export declare function dashboardUrlForPost(post: Pick<Post, 'id' | 'scheduled_at'>): string;
7
- export declare function dashboardUrlForPosts(): string;
8
- export declare function dashboardUrlForPostList(posts: Array<Pick<Post, 'scheduled_at'>>): string;
9
- export declare function truncateText(value: string | null | undefined, max?: number): string;
10
- export declare function formatAccountLabel(account: Account): string;
11
- export declare function formatConnectedAccounts(accounts?: Account[]): string;
1
+ type CellValue = string | number | boolean | null | undefined;
2
+ export declare function mdTitle(title: string, subtitle?: string): string;
3
+ export declare function mdTable(headers: string[], rows: CellValue[][]): string;
4
+ export declare function mdKeyValue(rows: Array<[string, CellValue]>): string;
5
+ export declare function mdSection(title: string, body?: string): string;
6
+ export declare function mdBullets(items: Array<string | null | undefined>): string;
7
+ export declare function mdJson(title: string, value: unknown): string;
8
+ export declare function mdQuote(text: string): string;
9
+ export declare function mdEmpty(title: string, detail: string, nextStep?: string): string;
10
+ export declare function mdSuccess(title: string, rows: Array<[string, CellValue]>, nextStep?: string): string;
11
+ export declare function mdError(message: string): string;
12
+ export declare function formatNumber(value: number | null | undefined): string;
13
+ export declare function formatPercent(value: number | null | undefined): string;
14
+ export declare function formatDelta(value: number | null | undefined): string;
15
+ export declare function formatDateTime(value: string | null | undefined): string;
16
+ export declare function formatDate(value: string | null | undefined): string;
17
+ export declare function formatBytes(value: number | null | undefined): string;
18
+ export declare function compactText(value: string | null | undefined, maxLength?: number): string;
19
+ export declare function statusLabel(status: string | null | undefined): string;
20
+ export declare function code(value: CellValue): string;
21
+ export {};