posterly-mcp-server 0.48.5 → 0.49.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 (49) hide show
  1. package/README.md +8 -2
  2. package/dist/lib/api-client.d.ts +80 -12
  3. package/dist/lib/api-client.js +40 -15
  4. package/dist/lib/format.d.ts +39 -2
  5. package/dist/lib/format.js +158 -0
  6. package/dist/lib/version.d.ts +1 -1
  7. package/dist/lib/version.js +1 -1
  8. package/dist/tools/audit-google-business-profile.d.ts +2 -2
  9. package/dist/tools/connect-account.d.ts +2 -2
  10. package/dist/tools/create-post.d.ts +12 -12
  11. package/dist/tools/create-posts-batch.d.ts +8 -8
  12. package/dist/tools/create-webhook.d.ts +2 -2
  13. package/dist/tools/disconnect-account.d.ts +2 -2
  14. package/dist/tools/find-slot.d.ts +2 -2
  15. package/dist/tools/get-updates.d.ts +4 -0
  16. package/dist/tools/get-updates.js +13 -1
  17. package/dist/tools/list-accounts.d.ts +2 -2
  18. package/dist/tools/list-activity.d.ts +4 -0
  19. package/dist/tools/list-activity.js +16 -3
  20. package/dist/tools/list-analytics.d.ts +2 -2
  21. package/dist/tools/list-comments.d.ts +2 -2
  22. package/dist/tools/list-conversations.d.ts +2 -2
  23. package/dist/tools/list-google-business-media.d.ts +2 -2
  24. package/dist/tools/list-google-business-reviews.d.ts +4 -4
  25. package/dist/tools/list-media.d.ts +4 -0
  26. package/dist/tools/list-media.js +22 -1
  27. package/dist/tools/list-platforms.d.ts +4 -4
  28. package/dist/tools/list-post-suggestions.d.ts +4 -0
  29. package/dist/tools/list-post-suggestions.js +16 -4
  30. package/dist/tools/list-posts.d.ts +35 -17
  31. package/dist/tools/list-posts.js +63 -33
  32. package/dist/tools/manage-comment.d.ts +2 -2
  33. package/dist/tools/manage-conversation.d.ts +4 -4
  34. package/dist/tools/manage-google-business-media.d.ts +8 -8
  35. package/dist/tools/manage-google-business-review.d.ts +10 -10
  36. package/dist/tools/manage-publishing-pause.d.ts +2 -2
  37. package/dist/tools/manage-webhook.d.ts +4 -4
  38. package/dist/tools/validate-post.d.ts +8 -8
  39. package/package.json +1 -1
  40. package/server.json +2 -2
  41. package/src/lib/api-client.ts +94 -17
  42. package/src/lib/format.ts +201 -1
  43. package/src/lib/version.ts +1 -1
  44. package/src/tools/get-updates.ts +15 -1
  45. package/src/tools/list-activity.ts +18 -3
  46. package/src/tools/list-media.ts +23 -2
  47. package/src/tools/list-post-suggestions.ts +17 -4
  48. package/src/tools/list-posts.ts +74 -45
  49. package/tool-registry.json +110 -5
@@ -658,9 +658,9 @@ export declare const createPostsBatchTool: {
658
658
  workspace_id: z.ZodOptional<z.ZodString>;
659
659
  }, "strip", z.ZodTypeAny, {
660
660
  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;
661
- username?: string | undefined;
662
- workspace_id?: string | undefined;
663
661
  account_id?: string | undefined;
662
+ workspace_id?: string | undefined;
663
+ username?: string | undefined;
664
664
  caption?: string | undefined;
665
665
  scheduled_at?: string | undefined;
666
666
  media_url?: string | undefined;
@@ -859,9 +859,9 @@ export declare const createPostsBatchTool: {
859
859
  }, z.ZodTypeAny, "passthrough"> | undefined;
860
860
  }, {
861
861
  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;
862
- username?: string | undefined;
863
- workspace_id?: string | undefined;
864
862
  account_id?: string | undefined;
863
+ workspace_id?: string | undefined;
864
+ username?: string | undefined;
865
865
  caption?: string | undefined;
866
866
  scheduled_at?: string | undefined;
867
867
  media_url?: string | undefined;
@@ -1064,9 +1064,9 @@ export declare const createPostsBatchTool: {
1064
1064
  confirm: true;
1065
1065
  posts: {
1066
1066
  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;
1067
- username?: string | undefined;
1068
- workspace_id?: string | undefined;
1069
1067
  account_id?: string | undefined;
1068
+ workspace_id?: string | undefined;
1069
+ username?: string | undefined;
1070
1070
  caption?: string | undefined;
1071
1071
  scheduled_at?: string | undefined;
1072
1072
  media_url?: string | undefined;
@@ -1268,9 +1268,9 @@ export declare const createPostsBatchTool: {
1268
1268
  confirm: true;
1269
1269
  posts: {
1270
1270
  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;
1271
- username?: string | undefined;
1272
- workspace_id?: string | undefined;
1273
1271
  account_id?: string | undefined;
1272
+ workspace_id?: string | undefined;
1273
+ username?: string | undefined;
1274
1274
  caption?: string | undefined;
1275
1275
  scheduled_at?: string | undefined;
1276
1276
  media_url?: string | undefined;
@@ -13,15 +13,15 @@ export declare const createWebhookTool: {
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  confirm: true;
15
15
  url: string;
16
- description?: string | undefined;
17
16
  workspace_id?: string | undefined;
17
+ description?: string | undefined;
18
18
  is_active?: boolean | undefined;
19
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
21
  confirm: true;
22
22
  url: string;
23
- description?: string | undefined;
24
23
  workspace_id?: string | undefined;
24
+ description?: string | undefined;
25
25
  is_active?: boolean | undefined;
26
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
  }>;
@@ -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
- confirm: boolean;
11
10
  account_id: string;
12
- }, {
13
11
  confirm: boolean;
12
+ }, {
14
13
  account_id: string;
14
+ confirm: boolean;
15
15
  }>;
16
16
  execute(client: PosterlyClient, input: {
17
17
  account_id: string;
@@ -11,14 +11,14 @@ export declare const findSlotTool: {
11
11
  strategy: z.ZodOptional<z.ZodEnum<["next_free", "best_engagement"]>>;
12
12
  }, "strip", z.ZodTypeAny, {
13
13
  workspace_id?: string | undefined;
14
- account_ids?: string[] | undefined;
15
14
  timezone?: string | undefined;
15
+ account_ids?: string[] | undefined;
16
16
  count?: number | undefined;
17
17
  strategy?: "next_free" | "best_engagement" | undefined;
18
18
  }, {
19
19
  workspace_id?: string | undefined;
20
- account_ids?: string[] | undefined;
21
20
  timezone?: string | undefined;
21
+ account_ids?: string[] | undefined;
22
22
  count?: number | undefined;
23
23
  strategy?: "next_free" | "best_engagement" | undefined;
24
24
  }>;
@@ -5,19 +5,23 @@ export declare const getUpdatesTool: {
5
5
  description: string;
6
6
  inputSchema: z.ZodObject<{
7
7
  limit: z.ZodOptional<z.ZodNumber>;
8
+ offset: z.ZodOptional<z.ZodNumber>;
8
9
  since: z.ZodOptional<z.ZodString>;
9
10
  include_content: z.ZodOptional<z.ZodBoolean>;
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  limit?: number | undefined;
13
+ offset?: number | undefined;
12
14
  since?: string | undefined;
13
15
  include_content?: boolean | undefined;
14
16
  }, {
15
17
  limit?: number | undefined;
18
+ offset?: number | undefined;
16
19
  since?: string | undefined;
17
20
  include_content?: boolean | undefined;
18
21
  }>;
19
22
  execute(client: PosterlyClient, input: {
20
23
  limit?: number;
24
+ offset?: number;
21
25
  since?: string;
22
26
  include_content?: boolean;
23
27
  }): Promise<string>;
@@ -1,9 +1,11 @@
1
1
  import { z } from 'zod';
2
+ import { formatPagingNote } from '../lib/format.js';
2
3
  export const getUpdatesTool = {
3
4
  name: 'get_updates',
4
- description: 'Get the latest posterly product updates and news from the updates feed: new features, improvements, and fixes. Requires an active posterly subscription.',
5
+ description: 'Get the latest posterly product updates and news from the updates feed: new features, improvements, and fixes, newest first. The output says whether more updates exist; page with offset or narrow with since. Requires an active posterly subscription.',
5
6
  inputSchema: z.object({
6
7
  limit: z.number().int().min(1).max(50).optional().describe('Number of updates to return. Default 10, max 50.'),
8
+ offset: z.number().int().min(0).optional().describe('How many updates to skip. Use the offset the previous page gives to get the next page.'),
7
9
  since: z.string().optional().describe('ISO date. Return updates published on or after this date.'),
8
10
  include_content: z.boolean().optional().describe('Include the full markdown body of each update. Defaults to false.'),
9
11
  }),
@@ -24,6 +26,16 @@ export const getUpdatesTool = {
24
26
  lines.push('', update.content.trim(), '');
25
27
  }
26
28
  }
29
+ lines.push('', formatPagingNote({
30
+ noun: 'updates',
31
+ tool: 'get_updates',
32
+ offset: result.offset ?? input.offset ?? 0,
33
+ count: result.updates.length,
34
+ total: result.total,
35
+ // An API older than has_more: a full page may mean more exist.
36
+ hasMore: result.has_more ?? result.updates.length >= (input.limit || 10),
37
+ nextOffset: result.next_offset,
38
+ }));
27
39
  return lines.join('\n');
28
40
  },
29
41
  };
@@ -18,14 +18,14 @@ export declare const listAccountsTool: {
18
18
  session_id: z.ZodOptional<z.ZodString>;
19
19
  debug: z.ZodOptional<z.ZodBoolean>;
20
20
  }, "strip", z.ZodTypeAny, {
21
- workspace_id?: string | undefined;
22
21
  account_id?: string | number | undefined;
22
+ workspace_id?: string | undefined;
23
23
  view?: "accounts" | "learned_voice" | "performance_profile" | "connect_session" | undefined;
24
24
  session_id?: string | undefined;
25
25
  debug?: boolean | undefined;
26
26
  }, {
27
- workspace_id?: string | undefined;
28
27
  account_id?: string | number | undefined;
28
+ workspace_id?: string | undefined;
29
29
  view?: "accounts" | "learned_voice" | "performance_profile" | "connect_session" | undefined;
30
30
  session_id?: string | undefined;
31
31
  debug?: boolean | undefined;
@@ -9,16 +9,19 @@ export declare const listActivityTool: {
9
9
  since: z.ZodOptional<z.ZodString>;
10
10
  type: z.ZodOptional<z.ZodEnum<["all", "activity", "publish"]>>;
11
11
  limit: z.ZodOptional<z.ZodNumber>;
12
+ offset: z.ZodOptional<z.ZodNumber>;
12
13
  }, "strip", z.ZodTypeAny, {
13
14
  workspace_id?: string | undefined;
14
15
  post_id?: number | undefined;
15
16
  limit?: number | undefined;
17
+ offset?: number | undefined;
16
18
  since?: string | undefined;
17
19
  type?: "activity" | "publish" | "all" | undefined;
18
20
  }, {
19
21
  workspace_id?: string | undefined;
20
22
  post_id?: number | undefined;
21
23
  limit?: number | undefined;
24
+ offset?: number | undefined;
22
25
  since?: string | undefined;
23
26
  type?: "activity" | "publish" | "all" | undefined;
24
27
  }>;
@@ -28,5 +31,6 @@ export declare const listActivityTool: {
28
31
  since?: string;
29
32
  type?: "all" | "activity" | "publish";
30
33
  limit?: number;
34
+ offset?: number;
31
35
  }): Promise<string>;
32
36
  };
@@ -1,21 +1,25 @@
1
1
  import { z } from 'zod';
2
+ import { formatPagingNote } from '../lib/format.js';
2
3
  export const listActivityTool = {
3
4
  name: 'list_activity',
4
- description: 'List recent activity and publish events for posts, including status changes, publish attempts, failures, and retries. Use this as the agent notifications feed.',
5
+ description: 'List recent activity and publish events for posts, including status changes, publish attempts, failures, and retries, newest first. Use this as the agent notifications feed. The output says whether more events exist; page with offset (offset + limit up to 1000) or narrow with since or post_id before concluding nothing else happened.',
5
6
  inputSchema: z.object({
6
7
  workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
7
8
  post_id: z.number().int().positive().optional().describe('Filter to one post ID.'),
8
9
  since: z.string().optional().describe('ISO datetime. Return events created at or after this time.'),
9
10
  type: z.enum(['all', 'activity', 'publish']).optional().describe('Event source filter. Defaults to all.'),
10
11
  limit: z.number().int().min(1).max(100).optional().describe('Number of items to return. Default 50, max 100.'),
12
+ offset: z.number().int().min(0).optional().describe('How many events to skip. Use the offset the previous page gives to get the next page.'),
11
13
  }),
12
14
  async execute(client, input) {
13
15
  const result = await client.listActivity(input);
14
16
  if (result.items.length === 0) {
15
- return 'No activity found matching your filters.';
17
+ return (input.offset ?? 0) > 0
18
+ ? `No activity on this page: offset ${input.offset} is past the last matching event.`
19
+ : 'No activity found matching your filters.';
16
20
  }
17
21
  const lines = [
18
- `Activity (${result.items.length} of ${result.total}):`,
22
+ `Activity (${result.items.length} on this page):`,
19
23
  ];
20
24
  for (const item of result.items) {
21
25
  const when = item.created_at ? new Date(item.created_at).toLocaleString() : 'unknown time';
@@ -30,6 +34,15 @@ export const listActivityTool = {
30
34
  lines.push(`- [${when}] post #${item.post_id || '?'} ${label}`);
31
35
  }
32
36
  }
37
+ lines.push('', formatPagingNote({
38
+ noun: 'events',
39
+ tool: 'list_activity',
40
+ offset: result.offset ?? input.offset ?? 0,
41
+ count: result.items.length,
42
+ // An API older than has_more: a full page may mean more exist.
43
+ hasMore: result.has_more ?? result.items.length >= (result.limit || 50),
44
+ nextOffset: result.next_offset,
45
+ }));
33
46
  return lines.join('\n');
34
47
  },
35
48
  };
@@ -29,7 +29,7 @@ export declare const listAnalyticsTool: {
29
29
  checkpoint: z.ZodOptional<z.ZodEnum<["1h", "6h", "24h", "72h", "7d"]>>;
30
30
  presentation: z.ZodOptional<z.ZodEnum<["compact", "table", "json"]>>;
31
31
  }, "strip", z.ZodTypeAny, {
32
- view: "accounts" | "posts" | "insights";
32
+ view: "posts" | "accounts" | "insights";
33
33
  account_id?: string | number | undefined;
34
34
  post_id?: number | undefined;
35
35
  checkpoint?: "1h" | "6h" | "24h" | "72h" | "7d" | undefined;
@@ -39,7 +39,7 @@ export declare const listAnalyticsTool: {
39
39
  to?: string | undefined;
40
40
  presentation?: "compact" | "table" | "json" | undefined;
41
41
  }, {
42
- view: "accounts" | "posts" | "insights";
42
+ view: "posts" | "accounts" | "insights";
43
43
  account_id?: string | number | undefined;
44
44
  post_id?: number | undefined;
45
45
  checkpoint?: "1h" | "6h" | "24h" | "72h" | "7d" | undefined;
@@ -25,8 +25,8 @@ export declare const listCommentsTool: {
25
25
  offset: z.ZodOptional<z.ZodNumber>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  platform?: "instagram" | "facebook" | "threads" | "linkedin" | undefined;
28
- workspace_id?: string | undefined;
29
28
  account_id?: number | undefined;
29
+ workspace_id?: string | undefined;
30
30
  limit?: number | undefined;
31
31
  offset?: number | undefined;
32
32
  filter?: "all" | "unread" | "flagged" | undefined;
@@ -34,8 +34,8 @@ export declare const listCommentsTool: {
34
34
  comment_id?: string | undefined;
35
35
  }, {
36
36
  platform?: "instagram" | "facebook" | "threads" | "linkedin" | undefined;
37
- workspace_id?: string | undefined;
38
37
  account_id?: number | undefined;
38
+ workspace_id?: string | undefined;
39
39
  limit?: number | undefined;
40
40
  offset?: number | undefined;
41
41
  filter?: "all" | "unread" | "flagged" | undefined;
@@ -25,8 +25,8 @@ export declare const listConversationsTool: {
25
25
  offset: z.ZodOptional<z.ZodNumber>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  platform?: "instagram" | "facebook" | "threads" | undefined;
28
- workspace_id?: string | undefined;
29
28
  account_id?: number | undefined;
29
+ workspace_id?: string | undefined;
30
30
  limit?: number | undefined;
31
31
  offset?: number | undefined;
32
32
  filter?: "all" | "unread" | "starred" | "archived" | undefined;
@@ -34,8 +34,8 @@ export declare const listConversationsTool: {
34
34
  conversation_id?: string | undefined;
35
35
  }, {
36
36
  platform?: "instagram" | "facebook" | "threads" | undefined;
37
- workspace_id?: string | undefined;
38
37
  account_id?: number | undefined;
38
+ workspace_id?: string | undefined;
39
39
  limit?: number | undefined;
40
40
  offset?: number | undefined;
41
41
  filter?: "all" | "unread" | "starred" | "archived" | undefined;
@@ -8,12 +8,12 @@ export declare const listGoogleBusinessMediaTool: {
8
8
  account_id: z.ZodOptional<z.ZodNumber>;
9
9
  location_id: z.ZodOptional<z.ZodString>;
10
10
  }, "strip", z.ZodTypeAny, {
11
- workspace_id?: string | undefined;
12
11
  account_id?: number | undefined;
12
+ workspace_id?: string | undefined;
13
13
  location_id?: string | undefined;
14
14
  }, {
15
- workspace_id?: string | undefined;
16
15
  account_id?: number | undefined;
16
+ workspace_id?: string | undefined;
17
17
  location_id?: string | undefined;
18
18
  }>;
19
19
  execute(client: PosterlyClient, input: {
@@ -24,8 +24,8 @@ export declare const listGoogleBusinessReviewsTool: {
24
24
  limit: z.ZodOptional<z.ZodNumber>;
25
25
  offset: z.ZodOptional<z.ZodNumber>;
26
26
  }, "strip", z.ZodTypeAny, {
27
- workspace_id?: string | undefined;
28
27
  account_id?: number | undefined;
28
+ workspace_id?: string | undefined;
29
29
  limit?: number | undefined;
30
30
  offset?: number | undefined;
31
31
  location_id?: string | undefined;
@@ -33,8 +33,8 @@ export declare const listGoogleBusinessReviewsTool: {
33
33
  unanswered?: boolean | undefined;
34
34
  view?: "reviews" | "review_link" | undefined;
35
35
  }, {
36
- workspace_id?: string | undefined;
37
36
  account_id?: number | undefined;
37
+ workspace_id?: string | undefined;
38
38
  limit?: number | undefined;
39
39
  offset?: number | undefined;
40
40
  location_id?: string | undefined;
@@ -49,12 +49,12 @@ export declare const listGoogleBusinessReviewsTool: {
49
49
  account_id: z.ZodOptional<z.ZodNumber>;
50
50
  location_id: z.ZodOptional<z.ZodString>;
51
51
  }, "strip", z.ZodTypeAny, {
52
- workspace_id?: string | undefined;
53
52
  account_id?: number | undefined;
53
+ workspace_id?: string | undefined;
54
54
  location_id?: string | undefined;
55
55
  }, {
56
- workspace_id?: string | undefined;
57
56
  account_id?: number | undefined;
57
+ workspace_id?: string | undefined;
58
58
  location_id?: string | undefined;
59
59
  }>;
60
60
  };
@@ -5,16 +5,20 @@ export declare const listMediaTool: {
5
5
  description: string;
6
6
  inputSchema: z.ZodObject<{
7
7
  limit: z.ZodOptional<z.ZodNumber>;
8
+ offset: z.ZodOptional<z.ZodNumber>;
8
9
  drop_session_id: z.ZodOptional<z.ZodString>;
9
10
  }, "strip", z.ZodTypeAny, {
10
11
  limit?: number | undefined;
12
+ offset?: number | undefined;
11
13
  drop_session_id?: string | undefined;
12
14
  }, {
13
15
  limit?: number | undefined;
16
+ offset?: number | undefined;
14
17
  drop_session_id?: string | undefined;
15
18
  }>;
16
19
  execute(client: PosterlyClient, input: {
17
20
  limit?: number;
21
+ offset?: number;
18
22
  drop_session_id?: string;
19
23
  }): Promise<string>;
20
24
  };
@@ -1,7 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { formatPagingNote } from '../lib/format.js';
2
3
  export const listMediaTool = {
3
4
  name: 'list_media',
4
- description: 'List the newest media assets for the authenticated user. After create_media_drop, pass drop_session_id to see files the human uploaded on /drop/<token>. Use public_url with validate_post / create_post.',
5
+ description: 'List the newest media assets for the authenticated user. After create_media_drop, pass drop_session_id to see files the human uploaded on /drop/<token>. Use public_url with validate_post / create_post. The output says whether every matching file is shown; page with offset (offset + limit up to 1000) when it is not.',
5
6
  inputSchema: z.object({
6
7
  limit: z
7
8
  .number()
@@ -10,6 +11,12 @@ export const listMediaTool = {
10
11
  .max(50)
11
12
  .optional()
12
13
  .describe('Number of assets to return (default 10, max 50)'),
14
+ offset: z
15
+ .number()
16
+ .int()
17
+ .min(0)
18
+ .optional()
19
+ .describe('How many assets to skip. Use the offset the previous page gives to get the next page.'),
13
20
  drop_session_id: z
14
21
  .string()
15
22
  .optional()
@@ -18,9 +25,13 @@ export const listMediaTool = {
18
25
  async execute(client, input) {
19
26
  const result = await client.listMedia({
20
27
  limit: input.limit,
28
+ offset: input.offset,
21
29
  dropSessionId: input.drop_session_id,
22
30
  });
23
31
  if (result.media.length === 0) {
32
+ if ((input.offset ?? 0) > 0 && result.total > 0) {
33
+ return `No media on this page: offset ${input.offset} is past the last of the ${result.total} matching files.`;
34
+ }
24
35
  return 'No media found. If you just sent a drop URL, wait for the user to finish uploading, then call list_media again.';
25
36
  }
26
37
  const lines = result.media.map((item) => {
@@ -28,10 +39,20 @@ export const listMediaTool = {
28
39
  const drop = item.drop_session_id ? ` drop=${item.drop_session_id}` : '';
29
40
  return `• ${item.filename} (${item.mime || 'unknown'}, ${size})${drop}\n public_url: ${item.public_url}`;
30
41
  });
42
+ const offset = result.offset ?? input.offset ?? 0;
31
43
  return [
32
44
  `Media (${result.media.length} of ${result.total}):`,
33
45
  ...lines,
34
46
  '',
47
+ formatPagingNote({
48
+ noun: 'files',
49
+ tool: 'list_media',
50
+ offset,
51
+ count: result.media.length,
52
+ total: result.total,
53
+ hasMore: result.has_more ?? offset + result.media.length < result.total,
54
+ nextOffset: result.next_offset,
55
+ }),
35
56
  'Pass public_url to validate_post / create_post. Do not invent URLs.',
36
57
  ].join('\n');
37
58
  },
@@ -23,17 +23,17 @@ export declare const listPlatformsTool: {
23
23
  debug: z.ZodOptional<z.ZodBoolean>;
24
24
  }, "strip", z.ZodTypeAny, {
25
25
  platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
26
+ account_id?: string | undefined;
26
27
  workspace_id?: string | undefined;
27
28
  include_planned?: boolean | undefined;
28
- account_id?: string | undefined;
29
29
  view?: "platforms" | "schema" | "connect_link" | undefined;
30
30
  debug?: boolean | undefined;
31
31
  target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
32
32
  }, {
33
33
  platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
34
+ account_id?: string | undefined;
34
35
  workspace_id?: string | undefined;
35
36
  include_planned?: boolean | undefined;
36
- account_id?: string | undefined;
37
37
  view?: "platforms" | "schema" | "connect_link" | undefined;
38
38
  debug?: boolean | undefined;
39
39
  target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
@@ -46,12 +46,12 @@ export declare const listPlatformsTool: {
46
46
  include_planned: z.ZodOptional<z.ZodBoolean>;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
49
- include_planned?: boolean | undefined;
50
49
  account_id?: string | undefined;
50
+ include_planned?: boolean | undefined;
51
51
  }, {
52
52
  platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
53
- include_planned?: boolean | undefined;
54
53
  account_id?: string | undefined;
54
+ include_planned?: boolean | undefined;
55
55
  }>;
56
56
  get_connect_link: z.ZodObject<{
57
57
  platform: z.ZodOptional<z.ZodEnum<["bluesky", "devto", "discord", "facebook", "facebook_instagram", "facebook_pages", "gmb", "google-business", "google_business", "google_business_profile", "hashnode", "instagram", "instagram-standalone", "instagram_direct", "lemmy", "linkedin", "linkedin-company", "linkedin-page", "linkedin_company", "linkedin_page", "linkedin_personal", "mastodon", "medium", "meta", "meta_business", "pinterest", "reddit", "skool", "slack", "telegram", "threads", "tiktok", "twitter", "whop", "wordpress", "x", "x_twitter", "youtube"]>>;
@@ -7,18 +7,22 @@ export declare const listPostSuggestionsTool: {
7
7
  account_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
8
8
  status: z.ZodOptional<z.ZodEnum<["pending", "scheduled", "dismissed"]>>;
9
9
  limit: z.ZodOptional<z.ZodNumber>;
10
+ offset: z.ZodOptional<z.ZodNumber>;
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  status?: "pending" | "scheduled" | "dismissed" | undefined;
12
13
  account_id?: string | number | undefined;
13
14
  limit?: number | undefined;
15
+ offset?: number | undefined;
14
16
  }, {
15
17
  status?: "pending" | "scheduled" | "dismissed" | undefined;
16
18
  account_id?: string | number | undefined;
17
19
  limit?: number | undefined;
20
+ offset?: number | undefined;
18
21
  }>;
19
22
  execute(client: PosterlyClient, input: {
20
23
  account_id?: string | number;
21
24
  status?: "pending" | "scheduled" | "dismissed";
22
25
  limit?: number;
26
+ offset?: number;
23
27
  }): Promise<string>;
24
28
  };
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { mdTitle, mdSection, mdKeyValue, mdEmpty, truncateText } from '../lib/format.js';
2
+ import { formatPagingNote, mdTitle, mdSection, mdKeyValue, mdEmpty, truncateText } from '../lib/format.js';
3
3
  export const listPostSuggestionsTool = {
4
4
  name: 'list_post_suggestions',
5
- description: "List proactive post suggestions: evidence-based weekly drafts posterly writes in each account's learned voice, each with a rationale tying it back to what has performed well for that account. Filter by account_id and status (pending, scheduled, dismissed; default pending). Read-only; requires a Pro plan or higher. Use dismiss_suggestion to hide one.",
5
+ description: "List proactive post suggestions: evidence-based weekly drafts posterly writes in each account's learned voice, each with a rationale tying it back to what has performed well for that account. Filter by account_id and status (pending, scheduled, dismissed; default pending). The output says whether every matching suggestion is shown; page with offset until it does. Read-only; requires a Pro plan or higher. Use dismiss_suggestion to hide one.",
6
6
  inputSchema: z.object({
7
7
  account_id: z
8
8
  .union([z.string(), z.number()])
@@ -13,9 +13,11 @@ export const listPostSuggestionsTool = {
13
13
  .optional()
14
14
  .describe('Suggestion status to list (default pending).'),
15
15
  limit: z.number().int().min(1).max(100).optional().describe('Max suggestions to return (default 20).'),
16
+ offset: z.number().int().min(0).optional().describe('How many suggestions to skip. Use the offset the previous page gives to get the next page.'),
16
17
  }),
17
18
  async execute(client, input) {
18
- const { suggestions } = await client.listPostSuggestions(input);
19
+ const page = await client.listPostSuggestions(input);
20
+ const { suggestions } = page;
19
21
  if (!suggestions.length) {
20
22
  return mdEmpty('post suggestions', 'No proactive post suggestions match these filters. posterly generates fresh drafts weekly for accounts with a learned voice.');
21
23
  }
@@ -31,6 +33,16 @@ export const listPostSuggestionsTool = {
31
33
  ['Rationale', suggestion.rationale ? truncateText(suggestion.rationale, 240) : undefined],
32
34
  ]));
33
35
  });
34
- return [mdTitle(`Post suggestions (${suggestions.length})`), ...blocks].join('\n\n');
36
+ const note = formatPagingNote({
37
+ noun: 'suggestions',
38
+ tool: 'list_post_suggestions',
39
+ offset: page.offset ?? input.offset ?? 0,
40
+ count: suggestions.length,
41
+ total: page.total,
42
+ // An API older than has_more: a full page may mean more exist.
43
+ hasMore: page.has_more ?? suggestions.length >= (input.limit || 20),
44
+ nextOffset: page.next_offset,
45
+ });
46
+ return [mdTitle(`Post suggestions (${suggestions.length})`), ...blocks, note].join('\n\n');
35
47
  },
36
48
  };
@@ -1,44 +1,62 @@
1
1
  import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
2
+ import type { ListPostsParams, PosterlyClient } from '../lib/api-client.js';
3
+ import { type ToolContext } from '../lib/tool-runtime.js';
4
+ type ListPostsInput = ListPostsParams & {
5
+ view?: 'list' | 'counts';
6
+ limit?: number;
7
+ offset?: number;
8
+ order?: 'asc' | 'desc';
9
+ };
10
+ export declare const LIST_POSTS_DESCRIPTION: string;
3
11
  export declare const listPostsTool: {
4
12
  name: string;
5
13
  description: string;
6
14
  inputSchema: z.ZodObject<{
15
+ view: z.ZodOptional<z.ZodEnum<["list", "counts"]>>;
7
16
  status: z.ZodOptional<z.ZodString>;
8
17
  platform: z.ZodOptional<z.ZodEnum<["bluesky", "devto", "discord", "facebook", "gmb", "google-business", "google_business", "google_business_profile", "hashnode", "instagram", "instagram-standalone", "lemmy", "linkedin", "mastodon", "pinterest", "slack", "telegram", "threads", "tiktok", "twitter", "wordpress", "x", "youtube"]>>;
9
18
  account_id: z.ZodOptional<z.ZodString>;
19
+ scheduled_from: z.ZodOptional<z.ZodString>;
20
+ scheduled_to: z.ZodOptional<z.ZodString>;
21
+ timezone: z.ZodOptional<z.ZodString>;
22
+ order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
10
23
  limit: z.ZodOptional<z.ZodNumber>;
24
+ offset: z.ZodOptional<z.ZodNumber>;
11
25
  workspace_id: z.ZodOptional<z.ZodString>;
12
26
  approval_status: z.ZodOptional<z.ZodEnum<["none", "pending_client", "approved", "changes_requested", "rejected"]>>;
13
27
  approval_waiting_on: z.ZodOptional<z.ZodEnum<["client", "team"]>>;
14
28
  brand_id: z.ZodOptional<z.ZodString>;
15
29
  }, "strip", z.ZodTypeAny, {
16
- 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;
17
30
  status?: string | undefined;
18
- workspace_id?: string | undefined;
31
+ 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;
19
32
  account_id?: string | undefined;
20
- limit?: number | undefined;
33
+ workspace_id?: string | undefined;
21
34
  approval_status?: "none" | "pending_client" | "approved" | "changes_requested" | "rejected" | undefined;
22
35
  approval_waiting_on?: "client" | "team" | undefined;
23
36
  brand_id?: string | undefined;
37
+ scheduled_from?: string | undefined;
38
+ scheduled_to?: string | undefined;
39
+ timezone?: string | undefined;
40
+ limit?: number | undefined;
41
+ offset?: number | undefined;
42
+ order?: "asc" | "desc" | undefined;
43
+ view?: "list" | "counts" | undefined;
24
44
  }, {
25
- 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;
26
45
  status?: string | undefined;
27
- workspace_id?: string | undefined;
46
+ 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;
28
47
  account_id?: string | undefined;
29
- limit?: number | undefined;
48
+ workspace_id?: string | undefined;
30
49
  approval_status?: "none" | "pending_client" | "approved" | "changes_requested" | "rejected" | undefined;
31
50
  approval_waiting_on?: "client" | "team" | undefined;
32
51
  brand_id?: string | undefined;
52
+ scheduled_from?: string | undefined;
53
+ scheduled_to?: string | undefined;
54
+ timezone?: string | undefined;
55
+ limit?: number | undefined;
56
+ offset?: number | undefined;
57
+ order?: "asc" | "desc" | undefined;
58
+ view?: "list" | "counts" | undefined;
33
59
  }>;
34
- execute(client: PosterlyClient, input: {
35
- status?: string;
36
- platform?: string;
37
- account_id?: string;
38
- limit?: number;
39
- workspace_id?: string;
40
- approval_status?: string;
41
- approval_waiting_on?: "client" | "team";
42
- brand_id?: string;
43
- }): Promise<string>;
60
+ execute(client: PosterlyClient, input: ListPostsInput, ctx: ToolContext): Promise<string>;
44
61
  };
62
+ export {};