posterly-mcp-server 0.43.8 → 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 (169) hide show
  1. package/README.md +310 -109
  2. package/dist/index.js +190 -874
  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 +97 -0
  6. package/dist/lib/api-client.js +81 -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-api-key.js +1 -1
  21. package/dist/tools/create-connect-session.d.ts +2 -2
  22. package/dist/tools/create-connect-session.js +2 -2
  23. package/dist/tools/create-post.d.ts +6 -6
  24. package/dist/tools/create-post.js +3 -3
  25. package/dist/tools/create-posts-batch.d.ts +4 -4
  26. package/dist/tools/create-webhook.d.ts +4 -4
  27. package/dist/tools/delete-post.d.ts +34 -10
  28. package/dist/tools/delete-post.js +52 -16
  29. package/dist/tools/disconnect-account.d.ts +2 -2
  30. package/dist/tools/generate-captions.d.ts +2 -2
  31. package/dist/tools/generate-image.d.ts +4 -4
  32. package/dist/tools/generate-image.js +2 -2
  33. package/dist/tools/generate-video.d.ts +6 -6
  34. package/dist/tools/generate-video.js +1 -1
  35. package/dist/tools/get-agent-signup-info.js +2 -2
  36. package/dist/tools/get-post.d.ts +16 -1
  37. package/dist/tools/get-post.js +35 -19
  38. package/dist/tools/list-accounts.d.ts +49 -3
  39. package/dist/tools/list-accounts.js +148 -33
  40. package/dist/tools/list-analytics.d.ts +111 -0
  41. package/dist/tools/list-analytics.js +393 -0
  42. package/dist/tools/list-brands.d.ts +38 -3
  43. package/dist/tools/list-brands.js +138 -20
  44. package/dist/tools/list-comments.d.ts +29 -9
  45. package/dist/tools/list-comments.js +75 -34
  46. package/dist/tools/list-conversations.d.ts +32 -9
  47. package/dist/tools/list-conversations.js +63 -27
  48. package/dist/tools/list-google-business-media.js +1 -1
  49. package/dist/tools/list-google-business-reviews.d.ts +32 -9
  50. package/dist/tools/list-google-business-reviews.js +77 -52
  51. package/dist/tools/list-jobs.d.ts +60 -0
  52. package/dist/tools/list-jobs.js +81 -0
  53. package/dist/tools/list-platforms.d.ts +62 -3
  54. package/dist/tools/list-platforms.js +118 -9
  55. package/dist/tools/list-posts.d.ts +2 -2
  56. package/dist/tools/list-workspace-members.d.ts +17 -0
  57. package/dist/tools/list-workspace-members.js +51 -0
  58. package/dist/tools/manage-comment.d.ts +102 -0
  59. package/dist/tools/manage-comment.js +125 -0
  60. package/dist/tools/manage-conversation.d.ts +79 -0
  61. package/dist/tools/manage-conversation.js +75 -0
  62. package/dist/tools/manage-google-business-media.d.ts +103 -0
  63. package/dist/tools/manage-google-business-media.js +126 -0
  64. package/dist/tools/manage-google-business-review.d.ts +146 -0
  65. package/dist/tools/manage-google-business-review.js +115 -0
  66. package/dist/tools/manage-oauth-client.d.ts +121 -0
  67. package/dist/tools/manage-oauth-client.js +94 -0
  68. package/dist/tools/manage-webhook.d.ts +99 -0
  69. package/dist/tools/manage-webhook.js +87 -0
  70. package/dist/tools/manage-workspace-member.d.ts +57 -0
  71. package/dist/tools/manage-workspace-member.js +131 -0
  72. package/dist/tools/reply-to-comment.d.ts +2 -2
  73. package/dist/tools/send-message.d.ts +2 -2
  74. package/dist/tools/start-signup.d.ts +2 -2
  75. package/dist/tools/submit-agent-feedback.d.ts +4 -4
  76. package/dist/tools/submit-product-feedback.d.ts +4 -4
  77. package/dist/tools/trigger-platform-helper.d.ts +2 -2
  78. package/dist/tools/update-post-release-id.d.ts +2 -2
  79. package/dist/tools/update-post-status.d.ts +2 -2
  80. package/dist/tools/update-post.d.ts +64 -13
  81. package/dist/tools/update-post.js +79 -26
  82. package/dist/tools/upload-media.d.ts +32 -9
  83. package/dist/tools/upload-media.js +54 -18
  84. package/dist/tools/validate-post.d.ts +4 -4
  85. package/dist/tools/whoami.d.ts +15 -2
  86. package/dist/tools/whoami.js +221 -25
  87. package/package.json +5 -3
  88. package/scripts/test-alias-transport.mjs +368 -0
  89. package/scripts/test-client-header-sanitization.mjs +78 -0
  90. package/scripts/test-tool-annotations.mjs +38 -17
  91. package/server.json +9 -2
  92. package/src/index.ts +227 -1411
  93. package/src/lib/alias-transport.ts +233 -0
  94. package/src/lib/api-client.ts +168 -0
  95. package/src/lib/preview-token-core.ts +157 -0
  96. package/src/lib/preview-token.ts +54 -0
  97. package/src/lib/tool-registry.ts +538 -0
  98. package/src/lib/tool-runtime.ts +117 -0
  99. package/src/lib/version.ts +1 -1
  100. package/src/tools/audit-google-business-profile.ts +1 -1
  101. package/src/tools/connect-account.ts +2 -2
  102. package/src/tools/create-api-key.ts +1 -1
  103. package/src/tools/create-connect-session.ts +2 -2
  104. package/src/tools/create-post.ts +3 -3
  105. package/src/tools/delete-post.ts +60 -19
  106. package/src/tools/generate-image.ts +2 -2
  107. package/src/tools/generate-video.ts +1 -1
  108. package/src/tools/get-agent-signup-info.ts +2 -2
  109. package/src/tools/get-post.ts +35 -21
  110. package/src/tools/list-accounts.ts +187 -39
  111. package/src/tools/list-analytics.ts +444 -0
  112. package/src/tools/list-brands.ts +162 -26
  113. package/src/tools/list-comments.ts +86 -43
  114. package/src/tools/list-conversations.ts +81 -39
  115. package/src/tools/list-google-business-media.ts +1 -1
  116. package/src/tools/list-google-business-reviews.ts +93 -64
  117. package/src/tools/list-jobs.ts +91 -0
  118. package/src/tools/list-platforms.ts +135 -11
  119. package/src/tools/list-workspace-members.ts +61 -0
  120. package/src/tools/manage-comment.ts +142 -0
  121. package/src/tools/manage-conversation.ts +89 -0
  122. package/src/tools/manage-google-business-media.ts +147 -0
  123. package/src/tools/manage-google-business-review.ts +139 -0
  124. package/src/tools/manage-oauth-client.ts +116 -0
  125. package/src/tools/manage-webhook.ts +103 -0
  126. package/src/tools/manage-workspace-member.ts +151 -0
  127. package/src/tools/update-post.ts +106 -39
  128. package/src/tools/upload-media.ts +76 -28
  129. package/src/tools/whoami.ts +253 -30
  130. package/tool-annotations.json +76 -144
  131. package/tool-registry.json +2085 -0
  132. package/src/tools/add-google-business-media.ts +0 -50
  133. package/src/tools/create-oauth-client.ts +0 -36
  134. package/src/tools/delete-comment.ts +0 -29
  135. package/src/tools/delete-google-business-media.ts +0 -30
  136. package/src/tools/delete-google-business-review-reply.ts +0 -30
  137. package/src/tools/delete-oauth-client.ts +0 -23
  138. package/src/tools/delete-post-group.ts +0 -17
  139. package/src/tools/delete-webhook.ts +0 -17
  140. package/src/tools/get-account-analytics.ts +0 -171
  141. package/src/tools/get-brand-profile.ts +0 -86
  142. package/src/tools/get-brand.ts +0 -34
  143. package/src/tools/get-comment.ts +0 -47
  144. package/src/tools/get-connect-link.ts +0 -61
  145. package/src/tools/get-connect-session.ts +0 -63
  146. package/src/tools/get-conversation.ts +0 -44
  147. package/src/tools/get-google-business-review-link.ts +0 -30
  148. package/src/tools/get-image-job.ts +0 -36
  149. package/src/tools/get-learned-voice.ts +0 -31
  150. package/src/tools/get-mcp-status.ts +0 -212
  151. package/src/tools/get-performance-profile.ts +0 -47
  152. package/src/tools/get-platform-schema.ts +0 -56
  153. package/src/tools/get-post-analytics.ts +0 -243
  154. package/src/tools/get-post-insights.ts +0 -60
  155. package/src/tools/get-post-missing.ts +0 -16
  156. package/src/tools/get-video-job.ts +0 -36
  157. package/src/tools/list-brand-accounts.ts +0 -36
  158. package/src/tools/reply-google-business-review.ts +0 -32
  159. package/src/tools/reply-to-comment.ts +0 -30
  160. package/src/tools/send-message.ts +0 -28
  161. package/src/tools/suggest-google-business-review-reply.ts +0 -44
  162. package/src/tools/sync-inbox.ts +0 -28
  163. package/src/tools/test-webhook.ts +0 -18
  164. package/src/tools/update-comment.ts +0 -31
  165. package/src/tools/update-oauth-client.ts +0 -38
  166. package/src/tools/update-post-release-id.ts +0 -25
  167. package/src/tools/update-post-status.ts +0 -31
  168. package/src/tools/update-webhook.ts +0 -36
  169. package/src/tools/upload-media-from-url.ts +0 -33
@@ -3,7 +3,7 @@ import { DASHBOARD_CONNECT_URL, formatConnectedAccounts, formatLocalDateTime } f
3
3
  import { CONNECT_INPUTS } from '../generated/platform-manifest.js';
4
4
  export const createConnectSessionTool = {
5
5
  name: 'create_connect_session',
6
- description: 'Create a short-lived posterly dashboard handoff session for connecting a social account. Send the secure connection URL to the user, then poll get_connect_session to narrate progress. Do not ask for social media passwords or OAuth codes; posterly handles those browser steps.',
6
+ description: 'Create a short-lived posterly dashboard handoff session for connecting a social account. Send the secure connection URL to the user, then poll list_accounts with view=connect_session to narrate progress. Do not ask for social media passwords or OAuth codes; posterly handles those browser steps.',
7
7
  inputSchema: z.object({
8
8
  platform: z
9
9
  .enum(CONNECT_INPUTS)
@@ -41,7 +41,7 @@ function formatConnectSession(session, includeRaw) {
41
41
  `Expires: ${formatLocalDateTime(session.expires_at)}`,
42
42
  `Dashboard connect page: ${DASHBOARD_CONNECT_URL}`,
43
43
  '',
44
- 'Next step for the AI agent: send the secure connection URL to the user, explain that posterly will handle the browser OAuth step, then poll get_connect_session until the account is connected or the session ends.',
44
+ 'Next step for the AI agent: send the secure connection URL to the user, explain that posterly will handle the browser OAuth step, then poll list_accounts with view=connect_session until the account is connected or the session ends.',
45
45
  includeRaw ? `\nRaw connect session:\n${JSON.stringify(session, null, 2)}` : '',
46
46
  ].filter(Boolean).join('\n');
47
47
  }
@@ -968,7 +968,7 @@ export declare const createPostPayloadInputSchema: z.ZodObject<{
968
968
  }, z.ZodTypeAny, "passthrough">>>;
969
969
  workspace_id: z.ZodOptional<z.ZodString>;
970
970
  }, "strip", z.ZodTypeAny, {
971
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
971
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
972
972
  username?: string | undefined;
973
973
  workspace_id?: string | undefined;
974
974
  account_id?: string | undefined;
@@ -1131,7 +1131,7 @@ export declare const createPostPayloadInputSchema: z.ZodObject<{
1131
1131
  ai_generated: z.ZodOptional<z.ZodBoolean>;
1132
1132
  }, z.ZodTypeAny, "passthrough"> | undefined;
1133
1133
  }, {
1134
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
1134
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
1135
1135
  username?: string | undefined;
1136
1136
  workspace_id?: string | undefined;
1137
1137
  account_id?: string | undefined;
@@ -1787,7 +1787,7 @@ export declare const createPostInputSchema: z.ZodObject<{
1787
1787
  confirm: z.ZodLiteral<true>;
1788
1788
  }, "strip", z.ZodTypeAny, {
1789
1789
  confirm: true;
1790
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
1790
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
1791
1791
  username?: string | undefined;
1792
1792
  workspace_id?: string | undefined;
1793
1793
  account_id?: string | undefined;
@@ -1951,7 +1951,7 @@ export declare const createPostInputSchema: z.ZodObject<{
1951
1951
  }, z.ZodTypeAny, "passthrough"> | undefined;
1952
1952
  }, {
1953
1953
  confirm: true;
1954
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
1954
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
1955
1955
  username?: string | undefined;
1956
1956
  workspace_id?: string | undefined;
1957
1957
  account_id?: string | undefined;
@@ -2613,7 +2613,7 @@ export declare const createPostTool: {
2613
2613
  confirm: z.ZodLiteral<true>;
2614
2614
  }, "strip", z.ZodTypeAny, {
2615
2615
  confirm: true;
2616
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
2616
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
2617
2617
  username?: string | undefined;
2618
2618
  workspace_id?: string | undefined;
2619
2619
  account_id?: string | undefined;
@@ -2777,7 +2777,7 @@ export declare const createPostTool: {
2777
2777
  }, z.ZodTypeAny, "passthrough"> | undefined;
2778
2778
  }, {
2779
2779
  confirm: true;
2780
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
2780
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
2781
2781
  username?: string | undefined;
2782
2782
  workspace_id?: string | undefined;
2783
2783
  account_id?: string | undefined;
@@ -151,7 +151,7 @@ export const createPostPayloadInputSchema = z.object({
151
151
  .describe('For X or Threads only: array of 2+ strings, one per post in the thread. The first entry leads, the rest reply in order. When set, the platform must be twitter or threads.'),
152
152
  instagram_settings: instagramSettingsSchema
153
153
  .optional()
154
- .describe('Instagram-specific settings. If “tag” is ambiguous, distinguish caption @mentions (put @username in caption), native media tags (user_tags), and co-author invitations (collaborators). Native media tags work with eligible direct or Meta-linked accounts; collaborators require an eligible Meta-linked account. Call get_platform_schema(account_id) first.'),
154
+ .describe('Instagram-specific settings. If “tag” is ambiguous, distinguish caption @mentions (put @username in caption), native media tags (user_tags), and co-author invitations (collaborators). Native media tags work with eligible direct or Meta-linked accounts; collaborators require an eligible Meta-linked account. Call list_platforms with view=schema and account_id first.'),
155
155
  platform_settings: platformSettingsSchema
156
156
  .optional()
157
157
  .describe('Platform-specific settings for the selected account. Use this for non-Instagram settings and prefer it over raw metadata.'),
@@ -218,9 +218,9 @@ export const createPostTool = {
218
218
  '4. If scheduling multiple posts in one turn, list every post first and confirm the batch as a whole, then prefer `create_posts_batch` so they are created in one API request.\n\n' +
219
219
  'AFTER CALLING: Tell the user the post was created, include the posterly dashboard link returned by the tool, and offer the next natural action. Do not narrate raw HTTP, curl, or API plumbing.\n\n' +
220
220
  'Provide either account_id OR username+platform to identify the account. If scheduled_at is omitted, the post publishes immediately. If workspace_id is omitted, the server resolves one from the social account, falling back to the caller\'s default (personal) workspace - pass workspace_id explicitly if the user has more than one workspace.\n\n' +
221
- 'MEDIA URLS: Posterly storage URLs are used as-is. Third-party HTTP(S) media URLs are copied into posterly storage before the post is saved, so API-created posts do not later fail on expired signed URLs. Short-lived signed URLs must still be live when this tool runs. You can also call `upload_media_from_url` first if you want to upload once and reuse the returned posterly URL across posts.\n\n' +
221
+ 'MEDIA URLS: Posterly storage URLs are used as-is. Third-party HTTP(S) media URLs are copied into posterly storage before the post is saved, so API-created posts do not later fail on expired signed URLs. Short-lived signed URLs must still be live when this tool runs. You can also call `upload_media` with `url` first if you want to upload once and reuse the returned posterly URL across posts.\n\n' +
222
222
  'THREADS: Pass `thread_posts` (an array of 2+ strings) to schedule a multi-post thread on X (Twitter) or Threads (Meta). The first entry is the lead post; the rest are published as replies in the same chain. X entries are capped at 280 characters each (4000 for verified, 25000 for organization accounts); Threads entries are capped at 500 characters each. When `thread_posts` is set, `caption` is ignored.\n\n' +
223
- 'PLATFORM SETTINGS: Pass `platform_settings` for composer-equivalent controls: Facebook story/reel/backgrounds, YouTube title/privacy/thumbnail/brandPartner, LinkedIn document titles/mentions/polls/content_call_to_action_label (including BUY_NOW and SHOP_NOW), TikTok direct-post privacy/toggles/commercial disclosure, Pinterest board/title/link/product_tags, GBP event/offer/CTA/recurrence, X reply settings/polls/paid_partnership, Threads reply controls/text attachments/ghost posts/spoilers/reply approvals/GIPHY, Telegram polls/buttons/video cover/live photo, Slack markdown/blocks, Mastodon visibility/quote/poll (media+poll allowed), and Instagram feed/story/reel/carousel/native media tags/collaborators/first comments/trial Reels/is_ai_generated/audio_id. For Instagram, @username in caption is only a caption mention; `user_tags` creates native media tags and `collaborators` sends co-author invitations only when the selected Meta-linked account reports those capabilities. Call `get_platform_schema` with the account ID first. `instagram_settings` remains as a backwards-compatible alias.\n\n' +
223
+ 'PLATFORM SETTINGS: Pass `platform_settings` for composer-equivalent controls: Facebook story/reel/backgrounds, YouTube title/privacy/thumbnail/brandPartner, LinkedIn document titles/mentions/polls/content_call_to_action_label (including BUY_NOW and SHOP_NOW), TikTok direct-post privacy/toggles/commercial disclosure, Pinterest board/title/link/product_tags, GBP event/offer/CTA/recurrence, X reply settings/polls/paid_partnership, Threads reply controls/text attachments/ghost posts/spoilers/reply approvals/GIPHY, Telegram polls/buttons/video cover/live photo, Slack markdown/blocks, Mastodon visibility/quote/poll (media+poll allowed), and Instagram feed/story/reel/carousel/native media tags/collaborators/first comments/trial Reels/is_ai_generated/audio_id. For Instagram, @username in caption is only a caption mention; `user_tags` creates native media tags and `collaborators` sends co-author invitations only when the selected Meta-linked account reports those capabilities. Call `list_platforms` with `view: "schema"` and the account ID first. `instagram_settings` remains as a backwards-compatible alias.\n\n' +
224
224
  'TIKTOK MEDIA: TikTok supports a single video or a photo slideshow of 1 to 35 images, never multiple videos. Image media auto-detects as a slideshow, so you usually do not set post_type or media_type for photos and every image is posted. Pass `platform_settings.media_type: "PHOTO"` to force a slideshow explicitly.',
225
225
  inputSchema: createPostInputSchema,
226
226
  async execute(client, input) {
@@ -495,7 +495,7 @@ export declare const createPostsBatchTool: {
495
495
  }, z.ZodTypeAny, "passthrough">>>;
496
496
  workspace_id: z.ZodOptional<z.ZodString>;
497
497
  }, "strip", z.ZodTypeAny, {
498
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
498
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
499
499
  username?: string | undefined;
500
500
  workspace_id?: string | undefined;
501
501
  account_id?: string | undefined;
@@ -658,7 +658,7 @@ export declare const createPostsBatchTool: {
658
658
  ai_generated: z.ZodOptional<z.ZodBoolean>;
659
659
  }, z.ZodTypeAny, "passthrough"> | undefined;
660
660
  }, {
661
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
661
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
662
662
  username?: string | undefined;
663
663
  workspace_id?: string | undefined;
664
664
  account_id?: string | undefined;
@@ -825,7 +825,7 @@ export declare const createPostsBatchTool: {
825
825
  }, "strip", z.ZodTypeAny, {
826
826
  confirm: true;
827
827
  posts: {
828
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
828
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
829
829
  username?: string | undefined;
830
830
  workspace_id?: string | undefined;
831
831
  account_id?: string | undefined;
@@ -991,7 +991,7 @@ export declare const createPostsBatchTool: {
991
991
  }, {
992
992
  confirm: true;
993
993
  posts: {
994
- platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "slack" | "mastodon" | "devto" | "hashnode" | "wordpress" | "lemmy" | "gmb" | "google-business" | "google_business_profile" | undefined;
994
+ platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
995
995
  username?: string | undefined;
996
996
  workspace_id?: string | undefined;
997
997
  account_id?: string | undefined;
@@ -11,19 +11,19 @@ export declare const createWebhookTool: {
11
11
  is_active: z.ZodOptional<z.ZodBoolean>;
12
12
  confirm: z.ZodLiteral<true>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- url: string;
15
14
  confirm: true;
15
+ url: string;
16
16
  description?: string | undefined;
17
17
  workspace_id?: string | undefined;
18
- events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
19
18
  is_active?: boolean | undefined;
19
+ events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
20
20
  }, {
21
- url: string;
22
21
  confirm: true;
22
+ url: string;
23
23
  description?: string | undefined;
24
24
  workspace_id?: string | undefined;
25
- events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
26
25
  is_active?: boolean | undefined;
26
+ events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
27
27
  }>;
28
28
  execute(client: PosterlyClient, input: {
29
29
  url: string;
@@ -1,20 +1,44 @@
1
1
  import { z } from 'zod';
2
2
  import type { PosterlyClient } from '../lib/api-client.js';
3
+ import { type ToolContext } from '../lib/tool-runtime.js';
4
+ type DeletePostInput = {
5
+ post_id?: number;
6
+ group_id?: string;
7
+ confirm?: boolean;
8
+ preview_id?: string;
9
+ };
3
10
  export declare const deletePostTool: {
4
11
  name: string;
5
12
  description: string;
6
13
  inputSchema: z.ZodObject<{
7
- post_id: z.ZodNumber;
8
- confirm: z.ZodLiteral<true>;
14
+ post_id: z.ZodOptional<z.ZodNumber>;
15
+ group_id: z.ZodOptional<z.ZodString>;
16
+ confirm: z.ZodOptional<z.ZodBoolean>;
17
+ preview_id: z.ZodOptional<z.ZodString>;
9
18
  }, "strip", z.ZodTypeAny, {
10
- post_id: number;
11
- confirm: true;
19
+ confirm?: boolean | undefined;
20
+ preview_id?: string | undefined;
21
+ post_id?: number | undefined;
22
+ group_id?: string | undefined;
12
23
  }, {
13
- post_id: number;
14
- confirm: true;
24
+ confirm?: boolean | undefined;
25
+ preview_id?: string | undefined;
26
+ post_id?: number | undefined;
27
+ group_id?: string | undefined;
15
28
  }>;
16
- execute(client: PosterlyClient, input: {
17
- post_id: number;
18
- confirm: true;
19
- }): Promise<string>;
29
+ /** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
30
+ legacySchemas: {
31
+ delete_post_group: z.ZodObject<{
32
+ group_id: z.ZodString;
33
+ confirm: z.ZodLiteral<true>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ confirm: true;
36
+ group_id: string;
37
+ }, {
38
+ confirm: true;
39
+ group_id: string;
40
+ }>;
41
+ };
42
+ execute(client: PosterlyClient, input: DeletePostInput, ctx: ToolContext): Promise<string>;
20
43
  };
44
+ export {};
@@ -1,24 +1,60 @@
1
1
  import { z } from 'zod';
2
- import { dashboardUrlForPosts } from '../lib/format.js';
2
+ import { code, dashboardUrlForPosts } from '../lib/format.js';
3
+ import { previewThenConfirm, validateArgs } from '../lib/tool-runtime.js';
3
4
  export const deletePostTool = {
4
5
  name: 'delete_post',
5
- description: 'Delete a scheduled or draft post. DESTRUCTIVE and IRREVERSIBLE - the post and its caption cannot be recovered. Cannot delete published or currently publishing posts.\n\n' +
6
- 'REQUIRED BEFORE CALLING: Fetch the post with `get_post` first and show the user what will be deleted (caption, account, scheduled time). Get explicit confirmation ("yes delete it", "remove it") before calling. Never delete multiple posts in a single batch without listing each one and confirming the full list.',
6
+ description: 'Delete posts. DESTRUCTIVE and IRREVERSIBLE: deleted posts and captions cannot be recovered, and published or currently publishing posts are never deleted. post_id: delete one scheduled or draft post; fetch it with `get_post` first, show the user what will be deleted (caption, account, scheduled time), and pass confirm=true only after explicit confirmation ("yes delete it", "remove it"). group_id: delete every draft, scheduled, failed, or paused post matching a caller-defined group_id, post_group_id, api_group_id, or release_id; preview then confirm: call without confirm to get a preview and preview_id, show it, then call again with confirm=true and that preview_id. Never delete several posts one by one without listing each and confirming the full list.',
7
7
  inputSchema: z.object({
8
- post_id: z.number().describe('The post ID to delete'),
9
- confirm: z.literal(true).describe('Must be true after explicit user confirmation of the post deletion.'),
8
+ post_id: z.number().optional().describe('Delete this one post.'),
9
+ group_id: z.string().min(1).max(160).optional().describe('Delete every unpublished post in this group or release instead.'),
10
+ confirm: z
11
+ .boolean()
12
+ .optional()
13
+ .describe('post_id: true after explicit user confirmation of the deletion. group_id: leave out to get a preview; true only with the preview_id after the user approved it.'),
14
+ preview_id: z.string().optional().describe('group_id: the preview_id from the preview call. Required with confirm: true.'),
10
15
  }),
11
- async execute(client, input) {
12
- if (input.confirm !== true) {
13
- throw new Error('Refusing to delete post without confirm=true after explicit user confirmation.');
16
+ /** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
17
+ legacySchemas: {
18
+ delete_post_group: z.object({
19
+ group_id: z.string().min(1).max(160),
20
+ confirm: z.literal(true),
21
+ }),
22
+ },
23
+ async execute(client, input, ctx) {
24
+ const { mode, args } = validateArgs(ctx, 'delete_post', input);
25
+ if (mode === 'group') {
26
+ return previewThenConfirm({
27
+ tool: 'delete_post',
28
+ action: 'group',
29
+ args,
30
+ nonce: false,
31
+ legacyRefusal: 'Refusing to delete post group without confirm=true after explicit user confirmation.',
32
+ ctx,
33
+ // GET /api/v1/posts has no group filter, so the preview says in plain
34
+ // words which posts match instead of listing them.
35
+ describe: async () => [
36
+ `Deletes every draft, scheduled, failed, or paused post whose group_id, post_group_id, api_group_id, or release_id is ${code(args.group_id)}. Published posts are never deleted. This cannot be undone.`,
37
+ 'To see the posts first, call list_posts and check each post\'s group or release ID.',
38
+ ].join('\n\n'),
39
+ run: async () => {
40
+ const result = await client.deletePostGroup(args.group_id);
41
+ return JSON.stringify(result, null, 2);
42
+ },
43
+ });
14
44
  }
15
- const result = await client.deletePost(input.post_id);
16
- return [
17
- `Post #${result.id} deleted successfully.`,
18
- 'It has been removed from the posterly queue.',
19
- `View queue in posterly: ${dashboardUrlForPosts()}`,
20
- '',
21
- 'Next step for the AI agent: tell the user the post is gone and offer to create, reschedule, or review the next post.',
22
- ].join('\n');
45
+ return deleteOne(client, args);
23
46
  },
24
47
  };
48
+ async function deleteOne(client, input) {
49
+ if (input.confirm !== true) {
50
+ throw new Error('Refusing to delete post without confirm=true after explicit user confirmation.');
51
+ }
52
+ const result = await client.deletePost(input.post_id);
53
+ return [
54
+ `Post #${result.id} deleted successfully.`,
55
+ 'It has been removed from the posterly queue.',
56
+ `View queue in posterly: ${dashboardUrlForPosts()}`,
57
+ '',
58
+ 'Next step for the AI agent: tell the user the post is gone and offer to create, reschedule, or review the next post.',
59
+ ].join('\n');
60
+ }
@@ -7,11 +7,11 @@ export declare const disconnectAccountTool: {
7
7
  account_id: z.ZodString;
8
8
  confirm: z.ZodBoolean;
9
9
  }, "strip", z.ZodTypeAny, {
10
- account_id: string;
11
10
  confirm: boolean;
12
- }, {
13
11
  account_id: string;
12
+ }, {
14
13
  confirm: boolean;
14
+ account_id: string;
15
15
  }>;
16
16
  execute(client: PosterlyClient, input: {
17
17
  account_id: string;
@@ -35,12 +35,12 @@ export declare const generateCaptionsTool: {
35
35
  platforms: ("instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business")[];
36
36
  workspace_id?: string | undefined;
37
37
  count?: number | undefined;
38
+ mode?: "generate" | "adapt" | undefined;
38
39
  social_account_id?: string | undefined;
39
40
  brief?: string | undefined;
40
41
  tone?: string | undefined;
41
42
  allow_emojis?: boolean | undefined;
42
43
  hashtag_strategy?: "none" | "smart" | "minimal" | "aggressive" | undefined;
43
- mode?: "generate" | "adapt" | undefined;
44
44
  source_caption?: string | undefined;
45
45
  source_platform?: "instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | undefined;
46
46
  preserve_links?: boolean | undefined;
@@ -55,12 +55,12 @@ export declare const generateCaptionsTool: {
55
55
  platforms: ("instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business")[];
56
56
  workspace_id?: string | undefined;
57
57
  count?: number | undefined;
58
+ mode?: "generate" | "adapt" | undefined;
58
59
  social_account_id?: string | undefined;
59
60
  brief?: string | undefined;
60
61
  tone?: string | undefined;
61
62
  allow_emojis?: boolean | undefined;
62
63
  hashtag_strategy?: "none" | "smart" | "minimal" | "aggressive" | undefined;
63
- mode?: "generate" | "adapt" | undefined;
64
64
  source_caption?: string | undefined;
65
65
  source_platform?: "instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | undefined;
66
66
  preserve_links?: boolean | undefined;
@@ -20,10 +20,10 @@ export declare const generateImageTool: {
20
20
  prompt: string;
21
21
  provider?: "google" | "xai" | undefined;
22
22
  aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "1:4" | "1:8" | "21:9" | "4:1" | "8:1" | "5:4" | undefined;
23
+ resolution?: "512" | "1K" | "2K" | "4K" | undefined;
24
+ model?: "pro" | "lite" | "flash" | undefined;
23
25
  style?: "minimal" | "professional" | "photographic" | "illustration" | "vibrant" | "youtube_thumbnail" | "reel_cover" | "review_background" | undefined;
24
26
  variations?: number | undefined;
25
- model?: "pro" | "lite" | "flash" | undefined;
26
- resolution?: "512" | "1K" | "2K" | "4K" | undefined;
27
27
  quality?: "low" | "medium" | "high" | undefined;
28
28
  thinking_level?: "minimal" | "high" | undefined;
29
29
  reference_image_urls?: string[] | undefined;
@@ -32,10 +32,10 @@ export declare const generateImageTool: {
32
32
  prompt: string;
33
33
  provider?: "google" | "xai" | undefined;
34
34
  aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "1:4" | "1:8" | "21:9" | "4:1" | "8:1" | "5:4" | undefined;
35
+ resolution?: "512" | "1K" | "2K" | "4K" | undefined;
36
+ model?: "pro" | "lite" | "flash" | undefined;
35
37
  style?: "minimal" | "professional" | "photographic" | "illustration" | "vibrant" | "youtube_thumbnail" | "reel_cover" | "review_background" | undefined;
36
38
  variations?: number | undefined;
37
- model?: "pro" | "lite" | "flash" | undefined;
38
- resolution?: "512" | "1K" | "2K" | "4K" | undefined;
39
39
  quality?: "low" | "medium" | "high" | undefined;
40
40
  thinking_level?: "minimal" | "high" | undefined;
41
41
  reference_image_urls?: string[] | undefined;
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { mdKeyValue, mdTitle } from '../lib/format.js';
3
3
  export const generateImageTool = {
4
4
  name: 'generate_image',
5
- description: 'Queue an AI image job via posterly using Nano Banana (Gemini) or Grok Imagine Image 2.0 (xAI). Returns job_id. Poll get_image_job until status is completed, then pass urls to create_post as media_url / media_urls. Gemini thinking high does not change the credit price.\n\n' +
5
+ description: 'Queue an AI image job via posterly using Nano Banana (Gemini) or Grok Imagine Image 2.0 (xAI). Returns job_id. Poll list_jobs with type=image until status is completed, then pass urls to create_post as media_url / media_urls. Gemini thinking high does not change the credit price.\n\n' +
6
6
  'COSTS CREDITS. Every call consumes part of the user\'s monthly AI image quota (or purchased credits once the quota is exhausted). Do NOT call speculatively - always describe the image you\'re about to generate (subject, style, aspect ratio, quality/thinking, resolution) to the user and get confirmation before calling.\n\n' +
7
7
  'If the user is over their plan limit and has no credits, this tool returns a 402 with upgrade info. Surface that message verbatim - do not retry.\n\n' +
8
8
  'Common aspect ratios by platform:\n' +
@@ -80,7 +80,7 @@ export const generateImageTool = {
80
80
  ['Credits used', result.credits_used],
81
81
  ['Billed from', result.usage?.billed_from],
82
82
  ]),
83
- result.message || 'Poll get_image_job with this job_id until status is completed, then pass urls to create_post.',
83
+ result.message || 'Poll list_jobs with type=image and this job_id until status is completed, then pass urls to create_post.',
84
84
  ].filter(Boolean).join('\n\n');
85
85
  },
86
86
  };
@@ -30,11 +30,11 @@ export declare const generateVideoTool: {
30
30
  confirm: true;
31
31
  prompt: string;
32
32
  provider?: "google" | "xai" | undefined;
33
- aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | undefined;
34
- model?: "lite" | "fast" | "standard" | undefined;
35
- resolution?: "480p" | "720p" | "1080p" | undefined;
36
33
  negative_prompt?: string | undefined;
34
+ aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | undefined;
37
35
  duration_seconds?: number | undefined;
36
+ resolution?: "480p" | "720p" | "1080p" | undefined;
37
+ model?: "lite" | "fast" | "standard" | undefined;
38
38
  image_url?: string | undefined;
39
39
  end_image_url?: string | undefined;
40
40
  reference_images?: {
@@ -47,11 +47,11 @@ export declare const generateVideoTool: {
47
47
  confirm: true;
48
48
  prompt: string;
49
49
  provider?: "google" | "xai" | undefined;
50
- aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | undefined;
51
- model?: "lite" | "fast" | "standard" | undefined;
52
- resolution?: "480p" | "720p" | "1080p" | undefined;
53
50
  negative_prompt?: string | undefined;
51
+ aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | undefined;
54
52
  duration_seconds?: number | undefined;
53
+ resolution?: "480p" | "720p" | "1080p" | undefined;
54
+ model?: "lite" | "fast" | "standard" | undefined;
55
55
  image_url?: string | undefined;
56
56
  end_image_url?: string | undefined;
57
57
  reference_images?: {
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export const generateVideoTool = {
3
3
  name: 'generate_video',
4
- description: 'Queue an AI video generation job with Google Veo 3.1 or xAI Grok Imagine Video 1.5. COSTS CREDITS: confirm provider, prompt, duration, resolution, aspect ratio, audio choice, and credit cost with the user before calling. Grok supports 1–15 seconds and 480p–1080p; reference-to-video is capped at 720p. Poll get_video_job for status and final video_url.',
4
+ description: 'Queue an AI video generation job with Google Veo 3.1 or xAI Grok Imagine Video 1.5. COSTS CREDITS: confirm provider, prompt, duration, resolution, aspect ratio, audio choice, and credit cost with the user before calling. Grok supports 1 to 15 seconds and 480p to 1080p; reference-to-video is capped at 720p. Poll list_jobs with type=video for status and final video_url.',
5
5
  inputSchema: z.object({
6
6
  provider: z.enum(['google', 'xai']).default('google').optional(),
7
7
  prompt: z.string().min(5).max(4000),
@@ -13,14 +13,14 @@ export const getAgentSignupInfoTool = {
13
13
  authState,
14
14
  '',
15
15
  'Pre-auth tools:',
16
- '- get_mcp_status: checks the installed server version, latest npm version, MCP endpoint health, API auth health, and whether POSTERLY_API_KEY is configured.',
16
+ '- whoami with view=status: checks the installed server version, latest npm version, MCP endpoint health, API auth health, and whether POSTERLY_API_KEY is configured.',
17
17
  '- start_signup: starts paid signup and returns a signup poll URL, a browser Checkout fallback, and, when enabled, a prepaid PaymentIntent for a Link virtual card (credential_type: card).',
18
18
  '- get_signup_session: polls payment, password, and agent-access status.',
19
19
  '',
20
20
  'After posterly access is installed, onboard the user IN THIS chat (do not send them to /onboarding-v2):',
21
21
  '- whoami: confirm the paid account and read onboarding.next_step.',
22
22
  '- About you: confirm name and IANA timezone.',
23
- '- create_connect_session / get_connect_session: first social account in the browser.',
23
+ '- create_connect_session, then list_accounts with view=connect_session: first social account in the browser.',
24
24
  '- Brand voice: ask how they want to sound, then use that on captions.',
25
25
  '- create_post: first scheduled post after validate_post and explicit confirm.',
26
26
  '',
@@ -1,16 +1,31 @@
1
1
  import { z } from 'zod';
2
2
  import type { PosterlyClient } from '../lib/api-client.js';
3
+ import { type ToolContext } from '../lib/tool-runtime.js';
3
4
  export declare const getPostTool: {
4
5
  name: string;
5
6
  description: string;
6
7
  inputSchema: z.ZodObject<{
7
8
  post_id: z.ZodNumber;
9
+ view: z.ZodOptional<z.ZodEnum<["post", "missing"]>>;
8
10
  }, "strip", z.ZodTypeAny, {
9
11
  post_id: number;
12
+ view?: "post" | "missing" | undefined;
10
13
  }, {
11
14
  post_id: number;
15
+ view?: "post" | "missing" | undefined;
12
16
  }>;
17
+ /** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
18
+ legacySchemas: {
19
+ get_post_missing: z.ZodObject<{
20
+ post_id: z.ZodNumber;
21
+ }, "strip", z.ZodTypeAny, {
22
+ post_id: number;
23
+ }, {
24
+ post_id: number;
25
+ }>;
26
+ };
13
27
  execute(client: PosterlyClient, input: {
14
28
  post_id: number;
15
- }): Promise<string>;
29
+ view?: "post" | "missing";
30
+ }, ctx: ToolContext): Promise<string>;
16
31
  };
@@ -1,28 +1,44 @@
1
1
  import { z } from 'zod';
2
2
  import { dashboardUrlForPost, formatLocalDateTime } from '../lib/format.js';
3
+ import { validateArgs } from '../lib/tool-runtime.js';
3
4
  export const getPostTool = {
4
5
  name: 'get_post',
5
- description: 'Get details of a specific post by ID. Returns caption, status, scheduled time, media, and platform info.',
6
+ description: 'One post by ID. view=post (default): caption, status, scheduled time, media, and platform info. view=missing: whether the post is missing required content, media, account, platform settings, or metadata before it can publish; use it to repair failed or imported posts.',
6
7
  inputSchema: z.object({
7
8
  post_id: z.number().describe('The post ID to look up'),
9
+ view: z.enum(['post', 'missing']).optional().describe('post (default) or missing.'),
8
10
  }),
9
- async execute(client, input) {
10
- const result = await client.getPost(input.post_id);
11
- const p = result.post;
12
- const lines = [
13
- `Post #${p.id}`,
14
- `• Status: ${p.status}`,
15
- `• Caption: ${p.content || '(empty)'}`,
16
- `• Type: ${p.post_type || 'unknown'}`,
17
- `• Scheduled: ${formatLocalDateTime(p.scheduled_at)}`,
18
- `• View in posterly: ${dashboardUrlForPost({ id: p.id, scheduled_at: p.scheduled_at })}`,
19
- ];
20
- if (p.platform_post_url)
21
- lines.push(`• Published URL: ${p.platform_post_url}`);
22
- if (p.media_url)
23
- lines.push(`• Media: ${p.media_url}`);
24
- if (p.media_urls?.length)
25
- lines.push(`• Media (${p.media_urls.length}): ${p.media_urls.join(', ')}`);
26
- return lines.join('\n');
11
+ /** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
12
+ legacySchemas: {
13
+ get_post_missing: z.object({ post_id: z.number().int().positive() }),
14
+ },
15
+ async execute(client, input, ctx) {
16
+ const { mode, args } = validateArgs(ctx, 'get_post', input);
17
+ if (mode === 'missing')
18
+ return postMissing(client, args);
19
+ return post(client, args);
27
20
  },
28
21
  };
22
+ async function post(client, input) {
23
+ const result = await client.getPost(input.post_id);
24
+ const p = result.post;
25
+ const lines = [
26
+ `Post #${p.id}`,
27
+ `• Status: ${p.status}`,
28
+ `• Caption: ${p.content || '(empty)'}`,
29
+ `• Type: ${p.post_type || 'unknown'}`,
30
+ `• Scheduled: ${formatLocalDateTime(p.scheduled_at)}`,
31
+ `• View in posterly: ${dashboardUrlForPost({ id: p.id, scheduled_at: p.scheduled_at })}`,
32
+ ];
33
+ if (p.platform_post_url)
34
+ lines.push(`• Published URL: ${p.platform_post_url}`);
35
+ if (p.media_url)
36
+ lines.push(`• Media: ${p.media_url}`);
37
+ if (p.media_urls?.length)
38
+ lines.push(`• Media (${p.media_urls.length}): ${p.media_urls.join(', ')}`);
39
+ return lines.join('\n');
40
+ }
41
+ async function postMissing(client, input) {
42
+ const result = await client.getPostMissing(input.post_id);
43
+ return JSON.stringify(result, null, 2);
44
+ }