posterly-mcp-server 0.45.0 โ†’ 0.45.1

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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/version.d.ts +1 -1
  3. package/dist/lib/version.js +1 -1
  4. package/dist/tools/create-post.d.ts +24 -1
  5. package/dist/tools/create-post.js +72 -6
  6. package/dist/tools/create-posts-batch.js +14 -2
  7. package/dist/tools/validate-post.js +2 -2
  8. package/package.json +1 -1
  9. package/scripts/test-payload-builders.mjs +143 -20
  10. package/server.json +2 -2
  11. package/src/lib/version.ts +1 -1
  12. package/src/tools/create-post.ts +84 -9
  13. package/src/tools/create-posts-batch.ts +13 -2
  14. package/src/tools/validate-post.ts +2 -1
  15. package/dist/tools/add-google-business-media.d.ts +0 -42
  16. package/dist/tools/add-google-business-media.js +0 -34
  17. package/dist/tools/create-oauth-client.d.ts +0 -40
  18. package/dist/tools/create-oauth-client.js +0 -20
  19. package/dist/tools/delete-comment.d.ts +0 -24
  20. package/dist/tools/delete-comment.js +0 -22
  21. package/dist/tools/delete-google-business-media.d.ts +0 -32
  22. package/dist/tools/delete-google-business-media.js +0 -17
  23. package/dist/tools/delete-google-business-review-reply.d.ts +0 -32
  24. package/dist/tools/delete-google-business-review-reply.js +0 -17
  25. package/dist/tools/delete-oauth-client.d.ts +0 -20
  26. package/dist/tools/delete-oauth-client.js +0 -13
  27. package/dist/tools/delete-post-group.d.ts +0 -20
  28. package/dist/tools/delete-post-group.js +0 -13
  29. package/dist/tools/delete-webhook.d.ts +0 -20
  30. package/dist/tools/delete-webhook.js +0 -13
  31. package/dist/tools/get-account-analytics.d.ts +0 -31
  32. package/dist/tools/get-account-analytics.js +0 -152
  33. package/dist/tools/get-brand-profile.d.ts +0 -16
  34. package/dist/tools/get-brand-profile.js +0 -73
  35. package/dist/tools/get-brand.d.ts +0 -16
  36. package/dist/tools/get-brand.js +0 -26
  37. package/dist/tools/get-comment.d.ts +0 -20
  38. package/dist/tools/get-comment.js +0 -36
  39. package/dist/tools/get-connect-link.d.ts +0 -28
  40. package/dist/tools/get-connect-link.js +0 -51
  41. package/dist/tools/get-connect-session.d.ts +0 -20
  42. package/dist/tools/get-connect-session.js +0 -54
  43. package/dist/tools/get-conversation.d.ts +0 -24
  44. package/dist/tools/get-conversation.js +0 -31
  45. package/dist/tools/get-google-business-review-link.d.ts +0 -24
  46. package/dist/tools/get-google-business-review-link.js +0 -19
  47. package/dist/tools/get-image-job.d.ts +0 -24
  48. package/dist/tools/get-image-job.js +0 -31
  49. package/dist/tools/get-learned-voice.d.ts +0 -16
  50. package/dist/tools/get-learned-voice.js +0 -22
  51. package/dist/tools/get-mcp-status.d.ts +0 -8
  52. package/dist/tools/get-mcp-status.js +0 -182
  53. package/dist/tools/get-performance-profile.d.ts +0 -16
  54. package/dist/tools/get-performance-profile.js +0 -39
  55. package/dist/tools/get-platform-schema.d.ts +0 -24
  56. package/dist/tools/get-platform-schema.js +0 -48
  57. package/dist/tools/get-post-analytics.d.ts +0 -39
  58. package/dist/tools/get-post-analytics.js +0 -222
  59. package/dist/tools/get-post-insights.d.ts +0 -28
  60. package/dist/tools/get-post-insights.js +0 -39
  61. package/dist/tools/get-post-missing.d.ts +0 -16
  62. package/dist/tools/get-post-missing.js +0 -12
  63. package/dist/tools/get-video-job.d.ts +0 -24
  64. package/dist/tools/get-video-job.js +0 -31
  65. package/dist/tools/list-brand-accounts.d.ts +0 -16
  66. package/dist/tools/list-brand-accounts.js +0 -24
  67. package/dist/tools/reply-google-business-review.d.ts +0 -36
  68. package/dist/tools/reply-google-business-review.js +0 -18
  69. package/dist/tools/reply-to-comment.d.ts +0 -32
  70. package/dist/tools/reply-to-comment.js +0 -17
  71. package/dist/tools/send-message.d.ts +0 -28
  72. package/dist/tools/send-message.js +0 -16
  73. package/dist/tools/suggest-google-business-review-reply.d.ts +0 -48
  74. package/dist/tools/suggest-google-business-review-reply.js +0 -27
  75. package/dist/tools/sync-inbox.d.ts +0 -24
  76. package/dist/tools/sync-inbox.js +0 -18
  77. package/dist/tools/test-webhook.d.ts +0 -20
  78. package/dist/tools/test-webhook.js +0 -14
  79. package/dist/tools/update-comment.d.ts +0 -28
  80. package/dist/tools/update-comment.js +0 -21
  81. package/dist/tools/update-oauth-client.d.ts +0 -44
  82. package/dist/tools/update-oauth-client.js +0 -21
  83. package/dist/tools/update-post-release-id.d.ts +0 -28
  84. package/dist/tools/update-post-release-id.js +0 -18
  85. package/dist/tools/update-post-status.d.ts +0 -28
  86. package/dist/tools/update-post-status.js +0 -23
  87. package/dist/tools/update-webhook.d.ts +0 -40
  88. package/dist/tools/update-webhook.js +0 -21
  89. package/dist/tools/upload-media-from-url.d.ts +0 -24
  90. package/dist/tools/upload-media-from-url.js +0 -26
@@ -1,42 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- declare const CATEGORIES: readonly ["COVER", "PROFILE", "LOGO", "EXTERIOR", "INTERIOR", "PRODUCT", "AT_WORK", "FOOD_AND_DRINK", "MENU", "COMMON_AREA", "ROOMS", "TEAMS", "ADDITIONAL"];
4
- export declare const addGoogleBusinessMediaTool: {
5
- name: string;
6
- description: string;
7
- inputSchema: z.ZodObject<{
8
- workspace_id: z.ZodOptional<z.ZodString>;
9
- account_id: z.ZodOptional<z.ZodNumber>;
10
- location_id: z.ZodOptional<z.ZodString>;
11
- source_url: z.ZodString;
12
- category: z.ZodEnum<["COVER", "PROFILE", "LOGO", "EXTERIOR", "INTERIOR", "PRODUCT", "AT_WORK", "FOOD_AND_DRINK", "MENU", "COMMON_AREA", "ROOMS", "TEAMS", "ADDITIONAL"]>;
13
- media_format: z.ZodOptional<z.ZodEnum<["PHOTO", "VIDEO"]>>;
14
- confirm: z.ZodLiteral<true>;
15
- }, "strip", z.ZodTypeAny, {
16
- confirm: true;
17
- source_url: string;
18
- category: "COVER" | "PROFILE" | "LOGO" | "EXTERIOR" | "INTERIOR" | "PRODUCT" | "AT_WORK" | "FOOD_AND_DRINK" | "MENU" | "COMMON_AREA" | "ROOMS" | "TEAMS" | "ADDITIONAL";
19
- workspace_id?: string | undefined;
20
- account_id?: number | undefined;
21
- location_id?: string | undefined;
22
- media_format?: "PHOTO" | "VIDEO" | undefined;
23
- }, {
24
- confirm: true;
25
- source_url: string;
26
- category: "COVER" | "PROFILE" | "LOGO" | "EXTERIOR" | "INTERIOR" | "PRODUCT" | "AT_WORK" | "FOOD_AND_DRINK" | "MENU" | "COMMON_AREA" | "ROOMS" | "TEAMS" | "ADDITIONAL";
27
- workspace_id?: string | undefined;
28
- account_id?: number | undefined;
29
- location_id?: string | undefined;
30
- media_format?: "PHOTO" | "VIDEO" | undefined;
31
- }>;
32
- execute(client: PosterlyClient, input: {
33
- workspace_id?: string;
34
- account_id?: number;
35
- location_id?: string;
36
- source_url: string;
37
- category: (typeof CATEGORIES)[number];
38
- media_format?: "PHOTO" | "VIDEO";
39
- confirm: true;
40
- }): Promise<any>;
41
- };
42
- export {};
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- const CATEGORIES = [
3
- 'COVER',
4
- 'PROFILE',
5
- 'LOGO',
6
- 'EXTERIOR',
7
- 'INTERIOR',
8
- 'PRODUCT',
9
- 'AT_WORK',
10
- 'FOOD_AND_DRINK',
11
- 'MENU',
12
- 'COMMON_AREA',
13
- 'ROOMS',
14
- 'TEAMS',
15
- 'ADDITIONAL',
16
- ];
17
- export const addGoogleBusinessMediaTool = {
18
- name: 'add_google_business_media',
19
- description: 'Add a photo or video to a Google Business Profile gallery (the media shown on Maps and Search). Provide a public https source_url first by uploading via upload_media_from_url or upload_media. COVER and PROFILE are single-slot and replace the existing one. WRITE: show the location, category, and media URL to the user, then pass confirm=true only after explicit confirmation.',
20
- inputSchema: z.object({
21
- workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
22
- account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts.'),
23
- location_id: z.string().optional().describe('Google Business numeric location id (the location_id/platform_user_id from list_accounts, e.g. "197940849675145390"). NOT the ChIJ... Place ID returned by get_google_business_review_link. Prefer account_id.'),
24
- source_url: z.string().url().describe('Public https URL of the photo or video (from upload_media / upload_media_from_url).'),
25
- category: z.enum(CATEGORIES).describe('Which gallery category to add the media to.'),
26
- media_format: z.enum(['PHOTO', 'VIDEO']).optional().describe('Defaults to PHOTO. Use VIDEO for videos (Google caps profile videos at 30s / 75MB).'),
27
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
28
- }),
29
- async execute(client, input) {
30
- const { confirm: _confirm, ...payload } = input;
31
- const result = await client.addGoogleBusinessMedia(payload);
32
- return result.message || 'Media added to the Google Business profile.';
33
- },
34
- };
@@ -1,40 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const createOAuthClientTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- client_name: z.ZodString;
8
- description: z.ZodOptional<z.ZodString>;
9
- homepage: z.ZodOptional<z.ZodString>;
10
- allowed_redirect_uris: z.ZodArray<z.ZodString, "many">;
11
- default_scopes: z.ZodArray<z.ZodEnum<["accounts:read", "accounts:write", "posts:read", "posts:write", "media:write", "analytics:read"]>, "many">;
12
- is_active: z.ZodOptional<z.ZodBoolean>;
13
- confirm: z.ZodLiteral<true>;
14
- }, "strip", z.ZodTypeAny, {
15
- confirm: true;
16
- client_name: string;
17
- allowed_redirect_uris: string[];
18
- default_scopes: ("accounts:read" | "accounts:write" | "posts:read" | "posts:write" | "media:write" | "analytics:read")[];
19
- description?: string | undefined;
20
- is_active?: boolean | undefined;
21
- homepage?: string | undefined;
22
- }, {
23
- confirm: true;
24
- client_name: string;
25
- allowed_redirect_uris: string[];
26
- default_scopes: ("accounts:read" | "accounts:write" | "posts:read" | "posts:write" | "media:write" | "analytics:read")[];
27
- description?: string | undefined;
28
- is_active?: boolean | undefined;
29
- homepage?: string | undefined;
30
- }>;
31
- execute(client: PosterlyClient, input: {
32
- client_name: string;
33
- description?: string;
34
- homepage?: string;
35
- allowed_redirect_uris: string[];
36
- default_scopes: string[];
37
- is_active?: boolean;
38
- confirm: true;
39
- }): Promise<string>;
40
- };
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- const scopeSchema = z.enum(['accounts:read', 'accounts:write', 'posts:read', 'posts:write', 'media:write', 'analytics:read']);
3
- export const createOAuthClientTool = {
4
- name: 'create_oauth_client',
5
- description: 'Create a public OAuth 2.1 + PKCE developer client. WRITE: confirm app name, redirect URIs, and scopes with the user before calling.',
6
- inputSchema: z.object({
7
- client_name: z.string().min(1).max(120),
8
- description: z.string().max(500).optional(),
9
- homepage: z.string().url().optional(),
10
- allowed_redirect_uris: z.array(z.string().url()).min(1).max(10),
11
- default_scopes: z.array(scopeSchema).min(1),
12
- is_active: z.boolean().optional(),
13
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
14
- }),
15
- async execute(client, input) {
16
- const { confirm: _confirm, ...payload } = input;
17
- const result = await client.createOAuthClient(payload);
18
- return `OAuth client created: ${result.client.client_name}\nclient_id: ${result.client.client_id}\nRedirect URIs: ${result.client.allowed_redirect_uris.join(', ')}`;
19
- },
20
- };
@@ -1,24 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deleteCommentTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- comment_id: z.ZodString;
8
- workspace_id: z.ZodOptional<z.ZodString>;
9
- confirm: z.ZodLiteral<true>;
10
- }, "strip", z.ZodTypeAny, {
11
- confirm: true;
12
- comment_id: string;
13
- workspace_id?: string | undefined;
14
- }, {
15
- confirm: true;
16
- comment_id: string;
17
- workspace_id?: string | undefined;
18
- }>;
19
- execute(client: PosterlyClient, input: {
20
- comment_id: string;
21
- workspace_id?: string;
22
- confirm: true;
23
- }): Promise<string>;
24
- };
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
2
- export const deleteCommentTool = {
3
- name: 'delete_comment',
4
- description: 'Delete an Instagram or Facebook Page inbox comment. DESTRUCTIVE and IRREVERSIBLE. Threads replies cannot be deleted; hide them with update_comment instead. Requires a Pro plan or higher, posts:write, and admin workspace access. Fetch with get_comment first and pass confirm=true only after explicit user confirmation.',
5
- inputSchema: z.object({
6
- comment_id: z.string().min(1).describe('Comment ID from list_comments or get_comment.'),
7
- workspace_id: z.string().optional().describe('Optional. Omit to search every workspace you belong to; pass a workspace ID from whoami to limit to one.'),
8
- confirm: z.literal(true).describe('Must be true after explicit user confirmation of the comment deletion.'),
9
- }),
10
- async execute(client, input) {
11
- if (input.confirm !== true) {
12
- throw new Error('Refusing to delete comment without confirm=true after explicit user confirmation.');
13
- }
14
- await client.deleteComment(input.comment_id, input.workspace_id);
15
- return [
16
- `Comment ${input.comment_id} deleted successfully.`,
17
- 'It has been deleted from the posterly inbox. On Instagram or Facebook it is also removed on the network when the platform call succeeds.',
18
- '',
19
- 'Next step for the AI agent: tell the user the comment is gone. Threads replies cannot be deleted; hide them with update_comment instead.',
20
- ].join('\n');
21
- },
22
- };
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deleteGoogleBusinessMediaTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- workspace_id: z.ZodOptional<z.ZodString>;
8
- account_id: z.ZodOptional<z.ZodNumber>;
9
- location_id: z.ZodOptional<z.ZodString>;
10
- media_name: z.ZodString;
11
- confirm: z.ZodLiteral<true>;
12
- }, "strip", z.ZodTypeAny, {
13
- confirm: true;
14
- media_name: string;
15
- workspace_id?: string | undefined;
16
- account_id?: number | undefined;
17
- location_id?: string | undefined;
18
- }, {
19
- confirm: true;
20
- media_name: string;
21
- workspace_id?: string | undefined;
22
- account_id?: number | undefined;
23
- location_id?: string | undefined;
24
- }>;
25
- execute(client: PosterlyClient, input: {
26
- workspace_id?: string;
27
- account_id?: number;
28
- location_id?: string;
29
- media_name: string;
30
- confirm: true;
31
- }): Promise<any>;
32
- };
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- export const deleteGoogleBusinessMediaTool = {
3
- name: 'delete_google_business_media',
4
- description: 'Remove a photo or video from a Google Business Profile gallery. Get media_name from list_google_business_media. This permanently deletes the item from the public profile. WRITE: show the exact media item and location to the user, then pass confirm=true only after explicit confirmation.',
5
- inputSchema: z.object({
6
- workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
7
- account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts.'),
8
- location_id: z.string().optional().describe('Google Business numeric location id (the location_id/platform_user_id from list_accounts, e.g. "197940849675145390"). NOT the ChIJ... Place ID returned by get_google_business_review_link. Prefer account_id.'),
9
- media_name: z.string().min(1).describe('Full media resource name from list_google_business_media (accounts/.../locations/.../media/...).'),
10
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
11
- }),
12
- async execute(client, input) {
13
- const { confirm: _confirm, ...payload } = input;
14
- const result = await client.deleteGoogleBusinessMedia(payload);
15
- return result.message || 'Media removed from the Google Business profile.';
16
- },
17
- };
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deleteGoogleBusinessReviewReplyTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- workspace_id: z.ZodOptional<z.ZodString>;
8
- account_id: z.ZodOptional<z.ZodNumber>;
9
- location_id: z.ZodOptional<z.ZodString>;
10
- review_name: z.ZodString;
11
- confirm: z.ZodLiteral<true>;
12
- }, "strip", z.ZodTypeAny, {
13
- confirm: true;
14
- review_name: string;
15
- workspace_id?: string | undefined;
16
- account_id?: number | undefined;
17
- location_id?: string | undefined;
18
- }, {
19
- confirm: true;
20
- review_name: string;
21
- workspace_id?: string | undefined;
22
- account_id?: number | undefined;
23
- location_id?: string | undefined;
24
- }>;
25
- execute(client: PosterlyClient, input: {
26
- workspace_id?: string;
27
- account_id?: number;
28
- location_id?: string;
29
- review_name: string;
30
- confirm: true;
31
- }): Promise<any>;
32
- };
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- export const deleteGoogleBusinessReviewReplyTool = {
3
- name: 'delete_google_business_review_reply',
4
- description: 'Delete the owner reply from a Google Business Profile review. DESTRUCTIVE: confirm the review and location with the user, then pass confirm=true only after explicit confirmation.',
5
- inputSchema: z.object({
6
- workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
7
- account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts.'),
8
- location_id: z.string().optional().describe('Google Business numeric location id (the location_id/platform_user_id from list_accounts, e.g. "197940849675145390"). NOT the ChIJ... Place ID returned by get_google_business_review_link. Prefer account_id.'),
9
- review_name: z.string().min(1).describe('Full Google review resource name.'),
10
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
11
- }),
12
- async execute(client, input) {
13
- const { confirm: _confirm, ...payload } = input;
14
- const result = await client.deleteGoogleBusinessReviewReply(payload);
15
- return result.message || 'Google Business review reply deleted successfully.';
16
- },
17
- };
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deleteOAuthClientTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- client_id: z.ZodString;
8
- confirm: z.ZodLiteral<true>;
9
- }, "strip", z.ZodTypeAny, {
10
- confirm: true;
11
- client_id: string;
12
- }, {
13
- confirm: true;
14
- client_id: string;
15
- }>;
16
- execute(client: PosterlyClient, input: {
17
- client_id: string;
18
- confirm: true;
19
- }): Promise<string>;
20
- };
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- export const deleteOAuthClientTool = {
3
- name: 'delete_oauth_client',
4
- description: 'Delete a self-serve OAuth developer client. DESTRUCTIVE: prevents new authorizations for that client_id; existing access tokens remain revocable as API keys.',
5
- inputSchema: z.object({
6
- client_id: z.string().min(1),
7
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
8
- }),
9
- async execute(client, input) {
10
- const result = await client.deleteOAuthClient(input.client_id);
11
- return `OAuth client deleted: ${result.client_id}`;
12
- },
13
- };
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deletePostGroupTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- group_id: z.ZodString;
8
- confirm: z.ZodLiteral<true>;
9
- }, "strip", z.ZodTypeAny, {
10
- confirm: true;
11
- group_id: string;
12
- }, {
13
- confirm: true;
14
- group_id: string;
15
- }>;
16
- execute(client: PosterlyClient, input: {
17
- group_id: string;
18
- confirm: true;
19
- }): Promise<string>;
20
- };
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- export const deletePostGroupTool = {
3
- name: 'delete_post_group',
4
- description: 'Delete every draft/scheduled/failed/paused post matching a caller-defined group_id, post_group_id, api_group_id, or release_id. DESTRUCTIVE: inspect the group first, list the affected posts, and pass confirm=true only after explicit confirmation.',
5
- inputSchema: z.object({
6
- group_id: z.string().min(1).max(160).describe('Group/release ID to delete.'),
7
- confirm: z.literal(true).describe('Must be true after explicit user confirmation.'),
8
- }),
9
- async execute(client, input) {
10
- const result = await client.deletePostGroup(input.group_id);
11
- return JSON.stringify(result, null, 2);
12
- },
13
- };
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const deleteWebhookTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- webhook_id: z.ZodString;
8
- confirm: z.ZodLiteral<true>;
9
- }, "strip", z.ZodTypeAny, {
10
- confirm: true;
11
- webhook_id: string;
12
- }, {
13
- confirm: true;
14
- webhook_id: string;
15
- }>;
16
- execute(client: PosterlyClient, input: {
17
- webhook_id: string;
18
- confirm: true;
19
- }): Promise<string>;
20
- };
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- export const deleteWebhookTool = {
3
- name: 'delete_webhook',
4
- description: 'Delete a webhook subscription. DESTRUCTIVE: list the webhook first, show the user its URL/events/workspace, and get explicit confirmation before calling.',
5
- inputSchema: z.object({
6
- webhook_id: z.string().describe('Webhook ID from list_webhooks.'),
7
- confirm: z.literal(true).describe('Must be true after the user explicitly confirms webhook deletion.'),
8
- }),
9
- async execute(client, input) {
10
- const result = await client.deleteWebhook(input.webhook_id);
11
- return `Webhook deleted: ${result.id}`;
12
- },
13
- };
@@ -1,31 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- declare const presentationSchema: z.ZodOptional<z.ZodEnum<["compact", "table", "json"]>>;
4
- type AnalyticsPresentation = z.infer<typeof presentationSchema>;
5
- export declare const getAccountAnalyticsTool: {
6
- name: string;
7
- description: string;
8
- inputSchema: z.ZodObject<{
9
- account_id: z.ZodNumber;
10
- from: z.ZodOptional<z.ZodString>;
11
- to: z.ZodOptional<z.ZodString>;
12
- presentation: z.ZodOptional<z.ZodEnum<["compact", "table", "json"]>>;
13
- }, "strip", z.ZodTypeAny, {
14
- account_id: number;
15
- from?: string | undefined;
16
- to?: string | undefined;
17
- presentation?: "compact" | "table" | "json" | undefined;
18
- }, {
19
- account_id: number;
20
- from?: string | undefined;
21
- to?: string | undefined;
22
- presentation?: "compact" | "table" | "json" | undefined;
23
- }>;
24
- execute(client: PosterlyClient, input: {
25
- account_id: number;
26
- from?: string;
27
- to?: string;
28
- presentation?: AnalyticsPresentation;
29
- }): Promise<string>;
30
- };
31
- export {};
@@ -1,152 +0,0 @@
1
- import { z } from 'zod';
2
- const presentationSchema = z.enum(['compact', 'table', 'json']).optional();
3
- export const getAccountAnalyticsTool = {
4
- name: 'get_account_analytics',
5
- description: 'Get daily analytics snapshots and a period summary for a connected social account. Supports Instagram, Facebook, LinkedIn, Google Business Profile, Pinterest, YouTube, and Threads. Uses API-provided display_metrics for platform-native dashboard labels and supports presentation: compact, table, or json.',
6
- inputSchema: z.object({
7
- account_id: z
8
- .number()
9
- .describe('The social account ID (from list_accounts)'),
10
- from: z
11
- .string()
12
- .optional()
13
- .describe('Start date (ISO date, e.g. 2026-03-19). Defaults to 30 days ago.'),
14
- to: z
15
- .string()
16
- .optional()
17
- .describe('End date (ISO date). Defaults to today.'),
18
- presentation: presentationSchema.describe('Output style: compact bullets, Markdown table, or raw JSON for client-side chart/card rendering.'),
19
- }),
20
- async execute(client, input) {
21
- const result = await client.getAccountAnalytics(input);
22
- return formatAccountAnalytics(result, input.presentation || 'compact');
23
- },
24
- };
25
- function formatAccountAnalytics(result, presentation) {
26
- const { account, range, summary, snapshots } = result;
27
- const rows = accountMetricRows(summary, account.platform);
28
- const insights = analyticsInsights(summary, account.platform);
29
- if (presentation === 'json') {
30
- return JSON.stringify({
31
- type: 'account_analytics',
32
- account,
33
- range,
34
- snapshot_count: snapshots.length,
35
- metrics: rows.map(([label, value]) => ({ label, value })),
36
- insights,
37
- summary,
38
- snapshots,
39
- }, null, 2);
40
- }
41
- if (presentation === 'table') {
42
- return [
43
- `**๐Ÿ“Š Analytics for ${accountLabel(account.username)} (${account.id})**`,
44
- `_${account.platform} ยท ${range.from} โ†’ ${range.to}_`,
45
- '',
46
- '**Account**',
47
- markdownTable(['Field', 'Value'], [
48
- ['Account ID', String(account.id)],
49
- ['Daily snapshots', formatNumber(snapshots.length)],
50
- ]),
51
- '',
52
- '**Metrics**',
53
- markdownTable(['Metric', 'Value'], rows),
54
- '',
55
- '**Quick read**',
56
- insights.map((insight) => `- ${insight}`).join('\n'),
57
- ].join('\n');
58
- }
59
- return [
60
- `**๐Ÿ“Š Analytics for ${accountLabel(account.username)} (${account.id})**`,
61
- `_${account.platform} ยท ${range.from} โ†’ ${range.to}_`,
62
- '',
63
- '**Account**',
64
- `- **Account ID:** ${account.id}`,
65
- `- **Daily snapshots:** ${formatNumber(snapshots.length)}`,
66
- '',
67
- '**Key metrics**',
68
- rows.map(([label, value]) => `- **${label}:** ${value}`).join('\n'),
69
- '',
70
- '**Quick read**',
71
- insights.map((insight) => `- ${insight}`).join('\n'),
72
- ].join('\n');
73
- }
74
- function accountMetricRows(summary, platform) {
75
- const nativeRows = nativeMetricRows(summary);
76
- if (nativeRows.length > 0)
77
- return nativeRows;
78
- if (platform === 'google_business') {
79
- const metrics = summary.platform_metrics || {};
80
- return [
81
- ['Profile Views', formatNumber(metrics.profile_views ?? summary.total_views)],
82
- ['Search Views', formatNumber(metrics.search_views ?? summary.total_reach)],
83
- ['Maps Views', formatNumber(metrics.maps_views ?? summary.total_profile_views)],
84
- ['Customer Actions', formatNumber(metrics.customer_actions ?? summary.total_accounts_engaged)],
85
- ['Posts', formatNumber(metrics.posts ?? summary.current_media_count)],
86
- ];
87
- }
88
- const rows = genericMetricRows(summary);
89
- if (platform === 'pinterest')
90
- rows.push(['Outbound clicks', formatNumber(summary.total_website_clicks)]);
91
- if (platform === 'youtube') {
92
- rows.push(['Watch minutes', formatNumber(summary.total_watch_minutes)]);
93
- rows.push(['Likes', formatNumber(summary.total_likes)]);
94
- }
95
- return rows;
96
- }
97
- function nativeMetricRows(summary) {
98
- return (summary.display_metrics || [])
99
- .filter((metric) => metric?.label)
100
- .map((metric) => [metric.label, formatNumber(metric.value)]);
101
- }
102
- function genericMetricRows(summary) {
103
- return [
104
- ['Followers', `${formatNumber(summary.current_followers)} (${formatDelta(summary.followers_change)} in range)`],
105
- ['Follows gained / lost', `+${formatNumber(summary.total_follows_gained)} / -${formatNumber(summary.total_follows_lost)}`],
106
- ['Total reach', formatNumber(summary.total_reach)],
107
- ['Total views', formatNumber(summary.total_views)],
108
- ['Profile views', formatNumber(summary.total_profile_views)],
109
- ['Accounts engaged', formatNumber(summary.total_accounts_engaged)],
110
- ['Engagement rate by reach', formatPercent(summary.engagement_rate)],
111
- ['Engagement rate by followers', formatPercent(summary.engagement_rate_by_followers)],
112
- ];
113
- }
114
- function analyticsInsights(summary, platform) {
115
- const insights = [];
116
- if (platform === 'google_business' && (summary.display_metrics?.length || 0) > 0) {
117
- insights.push('Google Business metrics are shown with dashboard-native labels.');
118
- }
119
- if ((summary.followers_change || 0) > 0)
120
- insights.push(`Audience grew by ${formatDelta(summary.followers_change)} followers in this range.`);
121
- if ((summary.followers_change || 0) < 0)
122
- insights.push(`Audience dipped by ${formatDelta(summary.followers_change)} followers in this range.`);
123
- if (summary.engagement_rate != null && platform !== 'google_business')
124
- insights.push(`Engagement by reach is ${formatPercent(summary.engagement_rate)}.`);
125
- if (platform === 'youtube' && summary.total_watch_minutes != null)
126
- insights.push(`${formatNumber(summary.total_watch_minutes)} total watch minutes were recorded.`);
127
- return insights.length ? insights : ['No standout movement detected in the returned period.'];
128
- }
129
- function formatDelta(n) {
130
- return n >= 0 ? `+${n.toLocaleString()}` : n.toLocaleString();
131
- }
132
- function formatNumber(value) {
133
- return value == null ? 'n/a' : value.toLocaleString();
134
- }
135
- function formatPercent(value) {
136
- return value == null ? 'n/a' : `${formatNumber(value)}%`;
137
- }
138
- function accountLabel(username) {
139
- if (!username)
140
- return 'account';
141
- return username.startsWith('@') || /\s/.test(username) ? username : `@${username}`;
142
- }
143
- function markdownTable(headers, rows) {
144
- return [
145
- `| ${headers.map(escapeCell).join(' | ')} |`,
146
- `| ${headers.map(() => '---').join(' | ')} |`,
147
- ...rows.map((row) => `| ${row.map(escapeCell).join(' | ')} |`),
148
- ].join('\n');
149
- }
150
- function escapeCell(value) {
151
- return String(value).replace(/\|/g, '\\|').replace(/\r?\n/g, '<br>');
152
- }
@@ -1,16 +0,0 @@
1
- import { z } from 'zod';
2
- import type { PosterlyClient } from '../lib/api-client.js';
3
- export declare const getBrandProfileTool: {
4
- name: string;
5
- description: string;
6
- inputSchema: z.ZodObject<{
7
- brand_id: z.ZodString;
8
- }, "strip", z.ZodTypeAny, {
9
- brand_id: string;
10
- }, {
11
- brand_id: string;
12
- }>;
13
- execute(client: PosterlyClient, input: {
14
- brand_id: string;
15
- }): Promise<string>;
16
- };