posterly-mcp-server 0.54.4 → 0.55.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.
- package/README.md +48 -5
- package/dist/generated/platform-manifest.d.ts +4 -4
- package/dist/generated/platform-manifest.js +9 -4
- package/dist/index.js +15 -2
- package/dist/lib/alias-transport.js +4 -0
- package/dist/lib/api-client.d.ts +152 -0
- package/dist/lib/api-client.js +88 -0
- package/dist/lib/claude-directory-profile.js +4 -2
- package/dist/lib/format.d.ts +44 -0
- package/dist/lib/format.js +125 -5
- package/dist/lib/gbp-location-preview.d.ts +21 -0
- package/dist/lib/gbp-location-preview.js +27 -0
- package/dist/lib/google-business-review-name.d.ts +36 -0
- package/dist/lib/google-business-review-name.js +83 -0
- package/dist/lib/id-schema.d.ts +14 -0
- package/dist/lib/id-schema.js +82 -0
- package/dist/lib/id-text.d.ts +26 -0
- package/dist/lib/id-text.js +63 -0
- package/dist/lib/reply-window.d.ts +5 -0
- package/dist/lib/reply-window.js +14 -0
- package/dist/lib/service-area-text.d.ts +27 -0
- package/dist/lib/service-area-text.js +41 -0
- package/dist/lib/suggestion-accept-note.d.ts +10 -0
- package/dist/lib/suggestion-accept-note.js +17 -0
- package/dist/lib/tool-registry.js +19 -2
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/tools/audit-google-business-profile.js +7 -3
- package/dist/tools/connect-account.d.ts +2 -2
- package/dist/tools/create-connect-session.d.ts +2 -2
- package/dist/tools/create-post.d.ts +6 -6
- package/dist/tools/create-posts-batch.d.ts +4 -4
- package/dist/tools/create-webhook.d.ts +3 -3
- package/dist/tools/delete-post.d.ts +4 -4
- package/dist/tools/dismiss-suggestion.d.ts +7 -0
- package/dist/tools/dismiss-suggestion.js +21 -2
- package/dist/tools/find-slot.js +7 -4
- package/dist/tools/get-post.js +56 -5
- package/dist/tools/list-accounts.d.ts +4 -0
- package/dist/tools/list-accounts.js +25 -6
- package/dist/tools/list-analytics.d.ts +4 -0
- package/dist/tools/list-analytics.js +29 -7
- package/dist/tools/list-comments.d.ts +10 -0
- package/dist/tools/list-comments.js +54 -22
- package/dist/tools/list-conversations.d.ts +19 -4
- package/dist/tools/list-conversations.js +55 -15
- package/dist/tools/list-google-business-locations.d.ts +27 -0
- package/dist/tools/list-google-business-locations.js +35 -0
- package/dist/tools/list-google-business-media.d.ts +8 -0
- package/dist/tools/list-google-business-media.js +19 -5
- package/dist/tools/list-google-business-reviews.js +12 -2
- package/dist/tools/list-google-business-service-areas.d.ts +37 -0
- package/dist/tools/list-google-business-service-areas.js +33 -0
- package/dist/tools/list-media.js +3 -2
- package/dist/tools/list-platforms.d.ts +10 -10
- package/dist/tools/list-post-suggestions.js +5 -4
- package/dist/tools/list-posts.d.ts +8 -2
- package/dist/tools/list-posts.js +12 -2
- package/dist/tools/list-webhooks.d.ts +18 -1
- package/dist/tools/list-webhooks.js +22 -3
- package/dist/tools/list-workspace-members.js +3 -1
- package/dist/tools/manage-brands.d.ts +47 -0
- package/dist/tools/manage-brands.js +89 -0
- package/dist/tools/manage-comment.js +5 -1
- package/dist/tools/manage-google-business-location.d.ts +123 -0
- package/dist/tools/manage-google-business-location.js +97 -0
- package/dist/tools/manage-google-business-media.js +2 -0
- package/dist/tools/manage-google-business-review.js +31 -5
- package/dist/tools/manage-google-business-service-area.d.ts +74 -0
- package/dist/tools/manage-google-business-service-area.js +79 -0
- package/dist/tools/manage-webhook.d.ts +6 -6
- package/dist/tools/manage-x-posting-addon.d.ts +47 -0
- package/dist/tools/manage-x-posting-addon.js +92 -0
- package/dist/tools/trigger-platform-helper.d.ts +5 -5
- package/dist/tools/update-post.d.ts +14 -6
- package/dist/tools/update-post.js +23 -2
- package/dist/tools/upload-media.d.ts +12 -0
- package/dist/tools/upload-media.js +39 -3
- package/dist/tools/validate-post.d.ts +4 -4
- package/dist/tools/webhook-events.d.ts +2 -2
- package/dist/tools/webhook-events.js +2 -0
- package/dist/tools/whoami.d.ts +4 -0
- package/dist/tools/whoami.js +14 -6
- package/package.json +1 -1
- package/server.json +2 -2
- package/tool-annotations.json +21 -2
- package/tool-registry.json +251 -8
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { code, mdKeyValue, mdSection } from '../lib/format.js';
|
|
3
|
+
import { formatGoogleBusinessServiceArea } from '../lib/service-area-text.js';
|
|
4
|
+
import { omitKeys, previewThenConfirm, readFailedNote, readForPreview, validateArgs } from '../lib/tool-runtime.js';
|
|
5
|
+
const LOCATION_ID_DESCRIPTION = 'Google Business numeric location id (the location_id/platform_user_id from list_accounts, e.g. "197940849675145390"). NOT the ChIJ... Place ID from list_google_business_reviews view=review_link. Prefer account_id.';
|
|
6
|
+
const placeSchema = z.object({
|
|
7
|
+
place_id: z.string(),
|
|
8
|
+
place_name: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export const manageGoogleBusinessServiceAreaTool = {
|
|
11
|
+
name: 'manage_google_business_service_area',
|
|
12
|
+
description: 'Replace the service areas on a Google Business location. action=update sends the full list (1 to 20 places, each with place_id and place_name from list_google_business_service_areas view=places or a known region Place ID). business_type is CUSTOMER_AND_BUSINESS_LOCATION (customers can visit, and you also travel) or CUSTOMER_LOCATION_ONLY (you only travel to customers). CUSTOMER_LOCATION_ONLY needs region_code when Google has not set one, and clear_storefront_address=true when a street address is still on the listing. The country cannot be changed once set. 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. Saving the same list again is safe.',
|
|
13
|
+
inputSchema: z.object({
|
|
14
|
+
action: z.enum(['update']).describe('update: replace the service area list.'),
|
|
15
|
+
workspace_id: z.string().optional(),
|
|
16
|
+
account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts.'),
|
|
17
|
+
location_id: z.string().optional().describe(LOCATION_ID_DESCRIPTION),
|
|
18
|
+
business_type: z.enum(['CUSTOMER_LOCATION_ONLY', 'CUSTOMER_AND_BUSINESS_LOCATION']).optional().describe('CUSTOMER_LOCATION_ONLY travels to customers. CUSTOMER_AND_BUSINESS_LOCATION also has a storefront.'),
|
|
19
|
+
region_code: z.string().optional().describe('Two-letter country code. Required for customer-only listings that do not already have one. Immutable once set.'),
|
|
20
|
+
places: z.array(placeSchema).max(20).optional().describe('The full replacement list, 1 to 20 areas. Each item needs place_id and place_name.'),
|
|
21
|
+
clear_storefront_address: z.boolean().optional().describe('Set true only when switching to customer-only. Google requires the street address to be removed from the listing in the same update; it is not kept, so adding it back means entering it again.'),
|
|
22
|
+
confirm: z.boolean().optional().describe('Leave out to get a preview; true only with the preview_id after the user approved it.'),
|
|
23
|
+
preview_id: z.string().optional().describe('The preview_id from the preview call. Required with confirm: true.'),
|
|
24
|
+
}),
|
|
25
|
+
async execute(client, input, ctx) {
|
|
26
|
+
const { args } = validateArgs(ctx, 'manage_google_business_service_area', input);
|
|
27
|
+
const call = args;
|
|
28
|
+
return previewThenConfirm({
|
|
29
|
+
tool: 'manage_google_business_service_area',
|
|
30
|
+
action: 'update',
|
|
31
|
+
args,
|
|
32
|
+
nonce: false,
|
|
33
|
+
legacyRefusal: 'Refusing to update Google Business service areas without confirm=true after explicit user confirmation.',
|
|
34
|
+
ctx,
|
|
35
|
+
describe: async () => {
|
|
36
|
+
const placeLines = (list, empty) => {
|
|
37
|
+
const rows = Array.isArray(list) ? list : [];
|
|
38
|
+
return rows.length
|
|
39
|
+
? rows.map((place) => `- ${place.place_name} :: ${place.place_id}`).join('\n')
|
|
40
|
+
: empty;
|
|
41
|
+
};
|
|
42
|
+
// The update replaces the whole list, so show what it replaces.
|
|
43
|
+
const read = await readForPreview(() => client.getGoogleBusinessServiceArea({
|
|
44
|
+
workspace_id: call.workspace_id,
|
|
45
|
+
account_id: call.account_id,
|
|
46
|
+
location_id: call.location_id,
|
|
47
|
+
}));
|
|
48
|
+
const current = read.ok ? read.data?.service_area : null;
|
|
49
|
+
return [
|
|
50
|
+
current
|
|
51
|
+
? mdSection('Current service areas', [
|
|
52
|
+
mdKeyValue([
|
|
53
|
+
['Business type', current.business_type || 'not set'],
|
|
54
|
+
['Country', current.region_code || 'not set'],
|
|
55
|
+
]),
|
|
56
|
+
placeLines(current.places, 'No areas are set.'),
|
|
57
|
+
].join('\n\n'))
|
|
58
|
+
: readFailedNote(read.ok ? 'no service area returned' : read.error),
|
|
59
|
+
mdSection('Service areas to save', [
|
|
60
|
+
mdKeyValue([
|
|
61
|
+
['Business type', call.business_type],
|
|
62
|
+
['Country', call.region_code || 'unchanged'],
|
|
63
|
+
['Remove street address', call.clear_storefront_address === true ? 'yes, it is deleted from the listing' : 'no'],
|
|
64
|
+
['Account ID', call.account_id !== undefined ? code(call.account_id) : undefined],
|
|
65
|
+
['Location ID', call.location_id ? code(call.location_id) : undefined],
|
|
66
|
+
['Workspace', call.workspace_id ? code(call.workspace_id) : undefined],
|
|
67
|
+
]),
|
|
68
|
+
placeLines(call.places, 'No areas in this request.'),
|
|
69
|
+
].join('\n\n')),
|
|
70
|
+
'This replaces the public service areas on Google. Google allows up to 20 towns or postcodes. Edits can take up to 48 hours to show.',
|
|
71
|
+
].join('\n\n');
|
|
72
|
+
},
|
|
73
|
+
run: async () => {
|
|
74
|
+
const result = await client.updateGoogleBusinessServiceArea(omitKeys(call, ['action', 'confirm', 'preview_id']));
|
|
75
|
+
return formatGoogleBusinessServiceArea(result);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
};
|
|
@@ -19,7 +19,7 @@ export declare const manageWebhookTool: {
|
|
|
19
19
|
action: z.ZodEnum<["update", "delete", "test"]>;
|
|
20
20
|
webhook_id: z.ZodString;
|
|
21
21
|
url: z.ZodOptional<z.ZodString>;
|
|
22
|
-
events: z.ZodOptional<z.ZodArray<z.ZodEnum<["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"]>, "many">>;
|
|
22
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<["webhook.test", "post.created", "post.updated", "post.deleted", "post.publishing", "post.published", "post.failed", "account.disconnected", "account.needs_reconnect", "account.reconnected", "analytics.synced", "approval.requested", "approval.approved", "approval.changes_requested", "approval.rejected", "approval.commented"]>, "many">>;
|
|
23
23
|
workspace_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
24
24
|
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
25
25
|
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -34,7 +34,7 @@ export declare const manageWebhookTool: {
|
|
|
34
34
|
preview_id?: string | undefined;
|
|
35
35
|
url?: string | undefined;
|
|
36
36
|
is_active?: boolean | undefined;
|
|
37
|
-
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;
|
|
37
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "account.needs_reconnect" | "account.reconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
38
38
|
}, {
|
|
39
39
|
action: "update" | "delete" | "test";
|
|
40
40
|
webhook_id: string;
|
|
@@ -44,14 +44,14 @@ export declare const manageWebhookTool: {
|
|
|
44
44
|
preview_id?: string | undefined;
|
|
45
45
|
url?: string | undefined;
|
|
46
46
|
is_active?: boolean | undefined;
|
|
47
|
-
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;
|
|
47
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "account.needs_reconnect" | "account.reconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
48
48
|
}>;
|
|
49
49
|
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
50
50
|
legacySchemas: {
|
|
51
51
|
update_webhook: z.ZodObject<{
|
|
52
52
|
webhook_id: z.ZodString;
|
|
53
53
|
url: z.ZodOptional<z.ZodString>;
|
|
54
|
-
events: z.ZodOptional<z.ZodArray<z.ZodEnum<["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"]>, "many">>;
|
|
54
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<["webhook.test", "post.created", "post.updated", "post.deleted", "post.publishing", "post.published", "post.failed", "account.disconnected", "account.needs_reconnect", "account.reconnected", "analytics.synced", "approval.requested", "approval.approved", "approval.changes_requested", "approval.rejected", "approval.commented"]>, "many">>;
|
|
55
55
|
workspace_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
56
56
|
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
57
57
|
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -63,7 +63,7 @@ export declare const manageWebhookTool: {
|
|
|
63
63
|
description?: string | null | undefined;
|
|
64
64
|
url?: string | undefined;
|
|
65
65
|
is_active?: boolean | undefined;
|
|
66
|
-
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;
|
|
66
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "account.needs_reconnect" | "account.reconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
67
67
|
}, {
|
|
68
68
|
confirm: true;
|
|
69
69
|
webhook_id: string;
|
|
@@ -71,7 +71,7 @@ export declare const manageWebhookTool: {
|
|
|
71
71
|
description?: string | null | undefined;
|
|
72
72
|
url?: string | undefined;
|
|
73
73
|
is_active?: boolean | undefined;
|
|
74
|
-
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;
|
|
74
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "account.needs_reconnect" | "account.reconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
75
75
|
}>;
|
|
76
76
|
delete_webhook: z.ZodObject<{
|
|
77
77
|
webhook_id: z.ZodString;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { PosterlyClient } from '../lib/api-client.js';
|
|
3
|
+
import { type ToolContext } from '../lib/tool-runtime.js';
|
|
4
|
+
type BuyInput = {
|
|
5
|
+
action: 'buy';
|
|
6
|
+
plan_code?: 'x_posts_100' | 'x_posts_250' | 'x_posts_500';
|
|
7
|
+
workspace_id?: string;
|
|
8
|
+
expected_addon_status?: string;
|
|
9
|
+
expected_plan_code?: string | null;
|
|
10
|
+
expected_price_usd?: number | null;
|
|
11
|
+
confirm?: boolean;
|
|
12
|
+
preview_id?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const manageXPostingAddonTool: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: z.ZodObject<{
|
|
18
|
+
action: z.ZodEnum<["buy"]>;
|
|
19
|
+
plan_code: z.ZodOptional<z.ZodEnum<["x_posts_100", "x_posts_250", "x_posts_500"]>>;
|
|
20
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
21
|
+
expected_addon_status: z.ZodOptional<z.ZodString>;
|
|
22
|
+
expected_plan_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
expected_price_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
preview_id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
action: "buy";
|
|
28
|
+
workspace_id?: string | undefined;
|
|
29
|
+
confirm?: boolean | undefined;
|
|
30
|
+
preview_id?: string | undefined;
|
|
31
|
+
plan_code?: "x_posts_100" | "x_posts_250" | "x_posts_500" | undefined;
|
|
32
|
+
expected_addon_status?: string | undefined;
|
|
33
|
+
expected_plan_code?: string | null | undefined;
|
|
34
|
+
expected_price_usd?: number | null | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
action: "buy";
|
|
37
|
+
workspace_id?: string | undefined;
|
|
38
|
+
confirm?: boolean | undefined;
|
|
39
|
+
preview_id?: string | undefined;
|
|
40
|
+
plan_code?: "x_posts_100" | "x_posts_250" | "x_posts_500" | undefined;
|
|
41
|
+
expected_addon_status?: string | undefined;
|
|
42
|
+
expected_plan_code?: string | null | undefined;
|
|
43
|
+
expected_price_usd?: number | null | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
execute(client: PosterlyClient, input: BuyInput, ctx: ToolContext): Promise<string>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
|
|
3
|
+
import { previewThenConfirm, readForPreview, validateArgs } from '../lib/tool-runtime.js';
|
|
4
|
+
const X_ADDON_DESCRIPTION = 'Buy an X posting add-on. action=buy: plan_code is x_posts_100 ($8/month, 100 extra posts), x_posts_250 ($18/month, 250), or x_posts_500 ($35/month, 500). Call without confirm to see the price. Show that price to the user. Nothing is charged on the preview. Then call again with confirm=true, the preview_id, and expected_addon_status, expected_plan_code, and expected_price_usd from the preview. Confirming returns a Stripe Checkout link. The card is charged only after the user pays on that page. If an add-on is already active, confirming opens the billing page for the workspace owner and does not buy a second plan. Read the allowance with get_x_posting_quota. Owner or admin. billing:write.';
|
|
5
|
+
function formatQuote(quote) {
|
|
6
|
+
const price = quote.price_usd == null ? 'n/a' : `$${quote.price_usd} per month`;
|
|
7
|
+
return [
|
|
8
|
+
mdTitle(quote.mode === 'portal' ? 'X posting add-on: billing page' : 'X posting add-on quote'),
|
|
9
|
+
quote.effect || '',
|
|
10
|
+
mdSection('Quote', mdKeyValue([
|
|
11
|
+
['Plan', quote.plan_name || quote.plan_code || 'none yet'],
|
|
12
|
+
['Price', price],
|
|
13
|
+
['Extra posts', quote.monthly_posts ?? 'n/a'],
|
|
14
|
+
['Charged now', 'no'],
|
|
15
|
+
['Current add-on status', quote.current_addon_status],
|
|
16
|
+
])),
|
|
17
|
+
'Nothing is charged until the Stripe page is paid.',
|
|
18
|
+
mdSection('Fields to repeat on confirm', [
|
|
19
|
+
`expected_addon_status: ${quote.current_addon_status}`,
|
|
20
|
+
`expected_plan_code: ${quote.current_plan_code == null ? 'null' : quote.current_plan_code}`,
|
|
21
|
+
`expected_price_usd: ${quote.price_usd == null ? 'null' : quote.price_usd}`,
|
|
22
|
+
].join('\n')),
|
|
23
|
+
].filter(Boolean).join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
export const manageXPostingAddonTool = {
|
|
26
|
+
name: 'manage_x_posting_addon',
|
|
27
|
+
description: X_ADDON_DESCRIPTION,
|
|
28
|
+
inputSchema: z.object({
|
|
29
|
+
action: z.enum(['buy']).describe('buy: quote an X posting add-on, then open Checkout after the user agrees.'),
|
|
30
|
+
plan_code: z.enum(['x_posts_100', 'x_posts_250', 'x_posts_500']).optional().describe('Which add-on to buy. Not used when one is already active.'),
|
|
31
|
+
workspace_id: z.string().optional().describe('Workspace ID from whoami, when the key is not already scoped.'),
|
|
32
|
+
expected_addon_status: z.string().optional().describe('From the preview. The add-on status the quote was based on.'),
|
|
33
|
+
expected_plan_code: z.string().nullable().optional().describe('From the preview. The current plan code, or null when there is none.'),
|
|
34
|
+
expected_price_usd: z.number().nullable().optional().describe('From the preview. The monthly price in dollars, or null.'),
|
|
35
|
+
confirm: z.boolean().optional().describe('True only after the user agrees, with the preview_id.'),
|
|
36
|
+
preview_id: z.string().optional().describe('The preview_id from the preview call.'),
|
|
37
|
+
}),
|
|
38
|
+
async execute(client, input, ctx) {
|
|
39
|
+
const { args } = validateArgs(ctx, 'manage_x_posting_addon', input);
|
|
40
|
+
const call = args;
|
|
41
|
+
let quote = null;
|
|
42
|
+
let previewArgs = args;
|
|
43
|
+
if (call.confirm !== true) {
|
|
44
|
+
const read = await readForPreview(() => client.quoteXPostingAddon({
|
|
45
|
+
...(call.plan_code ? { plan_code: call.plan_code } : {}),
|
|
46
|
+
...(call.workspace_id ? { workspace_id: call.workspace_id } : {}),
|
|
47
|
+
}));
|
|
48
|
+
if (!read.ok) {
|
|
49
|
+
throw new Error([
|
|
50
|
+
'No preview: this add-on cannot be started right now.',
|
|
51
|
+
read.error,
|
|
52
|
+
'Nothing was charged and no preview_id was issued.',
|
|
53
|
+
].join('\n\n'));
|
|
54
|
+
}
|
|
55
|
+
quote = read.data.quote;
|
|
56
|
+
previewArgs = {
|
|
57
|
+
...args,
|
|
58
|
+
expected_addon_status: quote.current_addon_status,
|
|
59
|
+
expected_plan_code: quote.current_plan_code,
|
|
60
|
+
expected_price_usd: quote.price_usd,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return previewThenConfirm({
|
|
64
|
+
tool: 'manage_x_posting_addon',
|
|
65
|
+
action: 'buy',
|
|
66
|
+
args: previewArgs,
|
|
67
|
+
nonce: true,
|
|
68
|
+
legacyRefusal: 'Refusing to start an X posting add-on without confirm=true after the user agrees.',
|
|
69
|
+
ctx,
|
|
70
|
+
describe: async () => formatQuote(quote || {}),
|
|
71
|
+
run: async () => {
|
|
72
|
+
if (call.expected_addon_status === undefined || call.expected_plan_code === undefined || call.expected_price_usd === undefined) {
|
|
73
|
+
throw new Error('Confirm needs expected_addon_status, expected_plan_code, and expected_price_usd from the preview. Get a new preview.');
|
|
74
|
+
}
|
|
75
|
+
const result = await client.buyXPostingAddon({
|
|
76
|
+
confirm: true,
|
|
77
|
+
expected_addon_status: call.expected_addon_status,
|
|
78
|
+
expected_plan_code: call.expected_plan_code,
|
|
79
|
+
expected_price_usd: call.expected_price_usd,
|
|
80
|
+
...(call.plan_code ? { plan_code: call.plan_code } : {}),
|
|
81
|
+
...(call.workspace_id ? { workspace_id: call.workspace_id } : {}),
|
|
82
|
+
});
|
|
83
|
+
const url = typeof result.url === 'string' ? result.url : '';
|
|
84
|
+
return [
|
|
85
|
+
mdTitle(result.mode === 'portal' ? 'Billing page, nothing charged' : 'Checkout page, nothing charged yet'),
|
|
86
|
+
result.effect || 'Nothing was charged.',
|
|
87
|
+
url ? `Open this page to finish: ${url}` : 'No page was returned. Nothing was charged.',
|
|
88
|
+
].join('\n\n');
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -4,18 +4,18 @@ export declare const triggerPlatformHelperTool: {
|
|
|
4
4
|
name: string;
|
|
5
5
|
description: string;
|
|
6
6
|
inputSchema: z.ZodObject<{
|
|
7
|
-
helper: z.ZodEnum<["linkedin.recent_mentions", "pinterest.boards", "tiktok.creator_info", "x.quota"]>;
|
|
7
|
+
helper: z.ZodEnum<["linkedin.company_lookup", "linkedin.recent_mentions", "pinterest.boards", "tiktok.creator_info", "x.quota", "youtube.playlists"]>;
|
|
8
8
|
account_id: z.ZodOptional<z.ZodString>;
|
|
9
9
|
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"]>>;
|
|
10
10
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
helper: "linkedin.recent_mentions" | "pinterest.boards" | "tiktok.creator_info" | "x.quota";
|
|
13
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
12
|
+
helper: "linkedin.company_lookup" | "linkedin.recent_mentions" | "pinterest.boards" | "tiktok.creator_info" | "x.quota" | "youtube.playlists";
|
|
13
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
14
14
|
account_id?: string | undefined;
|
|
15
15
|
params?: Record<string, unknown> | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
helper: "linkedin.recent_mentions" | "pinterest.boards" | "tiktok.creator_info" | "x.quota";
|
|
18
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
17
|
+
helper: "linkedin.company_lookup" | "linkedin.recent_mentions" | "pinterest.boards" | "tiktok.creator_info" | "x.quota" | "youtube.playlists";
|
|
18
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
19
19
|
account_id?: string | undefined;
|
|
20
20
|
params?: Record<string, unknown> | undefined;
|
|
21
21
|
}>;
|
|
@@ -681,6 +681,8 @@ type EditInput = {
|
|
|
681
681
|
media_url?: string;
|
|
682
682
|
media_urls?: string[];
|
|
683
683
|
post_type?: string;
|
|
684
|
+
account_id?: string;
|
|
685
|
+
thread_posts?: string[];
|
|
684
686
|
instagram_settings?: z.infer<typeof instagramSettingsSchema>;
|
|
685
687
|
platform_settings?: z.infer<typeof platformSettingsSchema>;
|
|
686
688
|
confirm: true;
|
|
@@ -703,6 +705,8 @@ export declare const updatePostTool: {
|
|
|
703
705
|
media_url: z.ZodOptional<z.ZodString>;
|
|
704
706
|
media_urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
705
707
|
post_type: z.ZodOptional<z.ZodString>;
|
|
708
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
709
|
+
thread_posts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
706
710
|
reel_cover_url: z.ZodOptional<z.ZodString>;
|
|
707
711
|
reel_cover_method: z.ZodOptional<z.ZodString>;
|
|
708
712
|
reel_thumb_offset: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1390,6 +1394,9 @@ export declare const updatePostTool: {
|
|
|
1390
1394
|
confirm: true;
|
|
1391
1395
|
post_id: number;
|
|
1392
1396
|
status?: "scheduled" | "paused" | "draft" | undefined;
|
|
1397
|
+
group_id?: string | undefined;
|
|
1398
|
+
release_id?: string | undefined;
|
|
1399
|
+
account_id?: string | undefined;
|
|
1393
1400
|
caption?: string | undefined;
|
|
1394
1401
|
scheduled_at?: string | undefined;
|
|
1395
1402
|
media_url?: string | undefined;
|
|
@@ -1398,6 +1405,7 @@ export declare const updatePostTool: {
|
|
|
1398
1405
|
reel_cover_url?: string | undefined;
|
|
1399
1406
|
reel_cover_method?: string | undefined;
|
|
1400
1407
|
reel_thumb_offset?: number | undefined;
|
|
1408
|
+
thread_posts?: string[] | undefined;
|
|
1401
1409
|
instagram_settings?: {
|
|
1402
1410
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
1403
1411
|
reel_cover_url?: string | undefined;
|
|
@@ -1599,8 +1607,6 @@ export declare const updatePostTool: {
|
|
|
1599
1607
|
is_poll_duration_extended: z.ZodOptional<z.ZodBoolean>;
|
|
1600
1608
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1601
1609
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1602
|
-
release_id?: string | undefined;
|
|
1603
|
-
group_id?: string | undefined;
|
|
1604
1610
|
approval_action?: "request" | "approve" | "request_changes" | "reject" | undefined;
|
|
1605
1611
|
approval_axis?: "asset" | "caption" | undefined;
|
|
1606
1612
|
approval_note?: string | undefined;
|
|
@@ -1608,6 +1614,9 @@ export declare const updatePostTool: {
|
|
|
1608
1614
|
confirm: true;
|
|
1609
1615
|
post_id: number;
|
|
1610
1616
|
status?: "scheduled" | "paused" | "draft" | undefined;
|
|
1617
|
+
group_id?: string | undefined;
|
|
1618
|
+
release_id?: string | undefined;
|
|
1619
|
+
account_id?: string | undefined;
|
|
1611
1620
|
caption?: string | undefined;
|
|
1612
1621
|
scheduled_at?: string | undefined;
|
|
1613
1622
|
media_url?: string | undefined;
|
|
@@ -1616,6 +1625,7 @@ export declare const updatePostTool: {
|
|
|
1616
1625
|
reel_cover_url?: string | undefined;
|
|
1617
1626
|
reel_cover_method?: string | undefined;
|
|
1618
1627
|
reel_thumb_offset?: number | undefined;
|
|
1628
|
+
thread_posts?: string[] | undefined;
|
|
1619
1629
|
instagram_settings?: {
|
|
1620
1630
|
post_type?: "post" | "feed" | "story" | "reel" | "carousel" | undefined;
|
|
1621
1631
|
reel_cover_url?: string | undefined;
|
|
@@ -1817,8 +1827,6 @@ export declare const updatePostTool: {
|
|
|
1817
1827
|
is_poll_duration_extended: z.ZodOptional<z.ZodBoolean>;
|
|
1818
1828
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1819
1829
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1820
|
-
release_id?: string | undefined;
|
|
1821
|
-
group_id?: string | undefined;
|
|
1822
1830
|
approval_action?: "request" | "approve" | "request_changes" | "reject" | undefined;
|
|
1823
1831
|
approval_axis?: "asset" | "caption" | undefined;
|
|
1824
1832
|
approval_note?: string | undefined;
|
|
@@ -1847,14 +1855,14 @@ export declare const updatePostTool: {
|
|
|
1847
1855
|
group_id: z.ZodOptional<z.ZodString>;
|
|
1848
1856
|
confirm: z.ZodLiteral<true>;
|
|
1849
1857
|
}, "strip", z.ZodTypeAny, {
|
|
1858
|
+
release_id: string;
|
|
1850
1859
|
confirm: true;
|
|
1851
1860
|
post_id: number;
|
|
1852
|
-
release_id: string;
|
|
1853
1861
|
group_id?: string | undefined;
|
|
1854
1862
|
}, {
|
|
1863
|
+
release_id: string;
|
|
1855
1864
|
confirm: true;
|
|
1856
1865
|
post_id: number;
|
|
1857
|
-
release_id: string;
|
|
1858
1866
|
group_id?: string | undefined;
|
|
1859
1867
|
}>;
|
|
1860
1868
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { code, formatDateTime, mdKeyValue, mdQuote, mdSection, mdTitle, statusLabel } from '../lib/format.js';
|
|
2
|
+
import { code, dashboardUrlForPost, formatDateTime, groupReleaseIds, mdKeyValue, mdQuote, mdSection, mdTitle, platformPostIdText, platformText, postFailureText, statusLabel } from '../lib/format.js';
|
|
3
3
|
import { validateArgs } from '../lib/tool-runtime.js';
|
|
4
4
|
const mediaAccessibilitySchema = z.array(z.object({
|
|
5
5
|
index: z.number().int().nonnegative(),
|
|
@@ -145,7 +145,7 @@ const platformSettingsSchema = z.object({
|
|
|
145
145
|
}).passthrough();
|
|
146
146
|
export const updatePostTool = {
|
|
147
147
|
name: 'update_post',
|
|
148
|
-
description: 'Change a scheduled or draft post. DESTRUCTIVE WRITE. Edit (default): caption, media, schedule, post_type, or
|
|
148
|
+
description: 'Change a scheduled or draft post. DESTRUCTIVE WRITE. Edit (default): caption, media, schedule, post_type, settings, account_id, or thread_posts; overwrites the existing post; cannot edit published or currently publishing posts. account_id moves the post to another account you can use in the same workspace and on the same brand, and the platform follows that account. thread_posts replaces an X or Threads reply chain with at least two non-empty parts, and the first part becomes the caption. If a client has already approved the post, a caption edit reopens caption approval, a media or thumbnail edit reopens asset approval, and a reschedule, account change, thread edit, or settings change reopens both. status (scheduled, paused, or draft, with scheduled_at when scheduling a draft): pause, resume, or move back to draft; send it on its own. release_id (with optional group_id): set or repair external release/group IDs; send it on its own. approval_action (request, approve, request_changes, or reject): change client approval. Only a workspace owner or admin may do this. The actor is the API key user, never a brand guest. request emails the brand reviewers. approve, request_changes, and reject are team-side decisions. request_changes needs approval_note. Optional approval_axis is asset or caption; omit it for both. Send approval_action on its own.\n\n' +
|
|
149
149
|
'REQUIRED BEFORE CALLING: Show the user a side-by-side of the CURRENT post (caption, scheduled time, media, status) and the PROPOSED change, and get explicit confirmation ("yes update it", "apply those changes") before calling. Do not auto-edit posts based on a general instruction - each change needs its own confirmation.',
|
|
150
150
|
inputSchema: z.object({
|
|
151
151
|
post_id: z.number().describe('The post ID to update'),
|
|
@@ -160,6 +160,15 @@ export const updatePostTool = {
|
|
|
160
160
|
.string()
|
|
161
161
|
.optional()
|
|
162
162
|
.describe('New post type: text, image, video, carousel, reel, story, story_series, document, photo, or cover_photo'),
|
|
163
|
+
account_id: z
|
|
164
|
+
.string()
|
|
165
|
+
.optional()
|
|
166
|
+
.describe('Move this unpublished post to another account you can use in the same workspace. The account must belong to the post brand. The platform follows the new account.'),
|
|
167
|
+
thread_posts: z
|
|
168
|
+
.array(z.string())
|
|
169
|
+
.min(2)
|
|
170
|
+
.optional()
|
|
171
|
+
.describe('Replace an X or Threads reply chain. At least 2 non-empty parts. The first part becomes the caption.'),
|
|
163
172
|
// Reel cover controls are also accepted top-level, matching the hosted
|
|
164
173
|
// endpoint. An agent reading the hosted schema will reach for these names,
|
|
165
174
|
// and scripts/check-mcp-schema-parity.ts enforces that both surfaces agree.
|
|
@@ -237,12 +246,24 @@ async function editPost(client, input) {
|
|
|
237
246
|
};
|
|
238
247
|
const result = await client.updatePost(post_id, payload);
|
|
239
248
|
const p = result.post;
|
|
249
|
+
const platform = platformText(p.platform);
|
|
250
|
+
const accountId = p.social_account_id ?? p.account_id;
|
|
251
|
+
const failure = postFailureText(p);
|
|
252
|
+
const platformPostId = platformPostIdText(p);
|
|
253
|
+
const groups = groupReleaseIds(p);
|
|
240
254
|
return [
|
|
241
255
|
mdTitle(`✅ Post ${code(p.id)} updated`),
|
|
242
256
|
mdKeyValue([
|
|
243
257
|
['Status', statusLabel(p.status)],
|
|
258
|
+
...(platform ? [['Platform', platform]] : []),
|
|
259
|
+
...(accountId != null && accountId !== '' ? [['Account ID', String(accountId)]] : []),
|
|
260
|
+
...(p.workspace_id ? [['Workspace', String(p.workspace_id)]] : []),
|
|
244
261
|
['Scheduled', formatDateTime(p.scheduled_at)],
|
|
245
262
|
['Type', p.post_type || 'unknown'],
|
|
263
|
+
...(failure ? [['Failure', failure]] : []),
|
|
264
|
+
...(platformPostId ? [['Platform post ID', platformPostId]] : []),
|
|
265
|
+
...(groups.length ? [['Group', groups.join(', ')]] : []),
|
|
266
|
+
['View in posterly', dashboardUrlForPost({ id: p.id, scheduled_at: p.scheduled_at })],
|
|
246
267
|
...(p.reel_cover_url ? [['Reel cover', p.reel_cover_url]] : []),
|
|
247
268
|
...(p.thumbnail_url ? [['Thumbnail', p.thumbnail_url]] : []),
|
|
248
269
|
...(p.youtube_thumbnail_url ? [['YouTube thumbnail', p.youtube_thumbnail_url]] : []),
|
|
@@ -8,6 +8,9 @@ type UploadMediaInput = {
|
|
|
8
8
|
filename?: string;
|
|
9
9
|
content_type?: string;
|
|
10
10
|
workspace_id?: string;
|
|
11
|
+
asset_id?: string;
|
|
12
|
+
confirm?: boolean;
|
|
13
|
+
preview_id?: string;
|
|
11
14
|
};
|
|
12
15
|
export declare const uploadMediaTool: {
|
|
13
16
|
name: string;
|
|
@@ -19,17 +22,26 @@ export declare const uploadMediaTool: {
|
|
|
19
22
|
filename: z.ZodOptional<z.ZodString>;
|
|
20
23
|
content_type: z.ZodOptional<z.ZodString>;
|
|
21
24
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
25
|
+
asset_id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
preview_id: z.ZodOptional<z.ZodString>;
|
|
22
28
|
}, "strip", z.ZodTypeAny, {
|
|
23
29
|
workspace_id?: string | undefined;
|
|
30
|
+
confirm?: boolean | undefined;
|
|
31
|
+
preview_id?: string | undefined;
|
|
24
32
|
filename?: string | undefined;
|
|
25
33
|
url?: string | undefined;
|
|
34
|
+
asset_id?: string | undefined;
|
|
26
35
|
content_type?: string | undefined;
|
|
27
36
|
file_path?: string | undefined;
|
|
28
37
|
base64_data?: string | undefined;
|
|
29
38
|
}, {
|
|
30
39
|
workspace_id?: string | undefined;
|
|
40
|
+
confirm?: boolean | undefined;
|
|
41
|
+
preview_id?: string | undefined;
|
|
31
42
|
filename?: string | undefined;
|
|
32
43
|
url?: string | undefined;
|
|
44
|
+
asset_id?: string | undefined;
|
|
33
45
|
content_type?: string | undefined;
|
|
34
46
|
file_path?: string | undefined;
|
|
35
47
|
base64_data?: string | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { mdError, mdSuccess } from '../lib/format.js';
|
|
3
|
-
import { validateArgs } from '../lib/tool-runtime.js';
|
|
2
|
+
import { formatIsoTimestamp, mdError, mdKeyValue, mdSection, mdSuccess } from '../lib/format.js';
|
|
3
|
+
import { previewThenConfirm, readFailedNote, readForPreview, validateArgs } from '../lib/tool-runtime.js';
|
|
4
4
|
export const uploadMediaTool = {
|
|
5
5
|
name: 'upload_media',
|
|
6
6
|
description: 'Upload an image or video to posterly storage and get a URL for create_post. Supports JPEG, PNG, GIF, WebP, MP4, MOV, WebM (PDFs are not accepted here: use create_signed_upload or create_media_drop). Images up to 10MB, videos up to 50MB. Three ways in: file_path (an explicit local path the user gave you), base64_data with filename (PREFERRED for images shared in chat, which are not on the local filesystem), or url (a public HTTPS image or video; local/private network URLs are blocked).\n\n' +
|
|
7
|
-
'This writes to the user\'s media storage (counts against quota) but does NOT publish the file anywhere. Uploading is safe - it\'s the subsequent `create_post` call that publishes content, and that tool has its own confirmation requirements. Never guess file paths. You can also pass public HTTP(S) media URLs directly to create_post/update_post; use url here when you want to upload once and reuse the returned posterly URL.',
|
|
7
|
+
'This writes to the user\'s media storage (counts against quota) but does NOT publish the file anywhere. Uploading is safe - it\'s the subsequent `create_post` call that publishes content, and that tool has its own confirmation requirements. Never guess file paths. You can also pass public HTTP(S) media URLs directly to create_post/update_post; use url here when you want to upload once and reuse the returned posterly URL. Pass asset_id (from list_media) to delete that library file: the first request previews it and deletes nothing; send it again with confirm true and that preview_id only after the user agrees. A file a post still uses is kept.',
|
|
8
8
|
inputSchema: z.object({
|
|
9
9
|
file_path: z
|
|
10
10
|
.string()
|
|
@@ -28,6 +28,9 @@ export const uploadMediaTool = {
|
|
|
28
28
|
.optional()
|
|
29
29
|
.describe('MIME type (auto-detected from filename if omitted)'),
|
|
30
30
|
workspace_id: z.string().optional().describe('Optional. The workspace this acts in and whose plan pays (from whoami). Needed only when your connection can act in several workspaces.'),
|
|
31
|
+
asset_id: z.string().optional().describe('Library file id from list_media. Deletes that file after a preview. Do not combine with url, file_path, or base64_data.'),
|
|
32
|
+
confirm: z.boolean().optional().describe('Delete only. True only after the user explicitly approves the preview, together with preview_id.'),
|
|
33
|
+
preview_id: z.string().optional().describe('The preview_id from the delete preview. Required with confirm: true.'),
|
|
31
34
|
}),
|
|
32
35
|
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
33
36
|
legacySchemas: {
|
|
@@ -39,11 +42,44 @@ export const uploadMediaTool = {
|
|
|
39
42
|
},
|
|
40
43
|
async execute(client, input, ctx) {
|
|
41
44
|
const { mode, args } = validateArgs(ctx, 'upload_media', input);
|
|
45
|
+
if (mode === 'delete')
|
|
46
|
+
return deleteLibraryFile(client, args, ctx);
|
|
42
47
|
if (mode === 'url')
|
|
43
48
|
return uploadFromUrl(client, args);
|
|
44
49
|
return uploadFile(client, args);
|
|
45
50
|
},
|
|
46
51
|
};
|
|
52
|
+
async function deleteLibraryFile(client, input, ctx) {
|
|
53
|
+
return previewThenConfirm({
|
|
54
|
+
tool: 'upload_media',
|
|
55
|
+
action: 'delete',
|
|
56
|
+
args: input,
|
|
57
|
+
nonce: false,
|
|
58
|
+
legacyRefusal: 'Refusing to delete a library file without confirm=true after explicit user confirmation.',
|
|
59
|
+
ctx,
|
|
60
|
+
describe: async () => {
|
|
61
|
+
const read = await readForPreview(() => client.getMediaAsset(input.asset_id));
|
|
62
|
+
const media = read.ok ? read.data.media : null;
|
|
63
|
+
const details = media
|
|
64
|
+
? mdSection('File', mdKeyValue([
|
|
65
|
+
['File', media.filename || 'file'],
|
|
66
|
+
['Type', media.mime || 'unknown'],
|
|
67
|
+
['Created', formatIsoTimestamp(media.created_at)],
|
|
68
|
+
]))
|
|
69
|
+
: [
|
|
70
|
+
read.ok ? '_This file was not found, so the preview shows the request as given._' : readFailedNote(read.error),
|
|
71
|
+
mdKeyValue([['File ID', input.asset_id]]),
|
|
72
|
+
].join('\n\n');
|
|
73
|
+
return [details, 'This permanently deletes the file from the library. A file a post still uses is kept.'].join('\n\n');
|
|
74
|
+
},
|
|
75
|
+
run: async () => {
|
|
76
|
+
const result = await client.deleteMediaAsset(input.asset_id);
|
|
77
|
+
return result.filename
|
|
78
|
+
? `Deleted ${result.filename} from the library.`
|
|
79
|
+
: 'Deleted the file from the library.';
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
47
83
|
async function uploadFile(client, input) {
|
|
48
84
|
if (!input.file_path && !input.base64_data) {
|
|
49
85
|
return mdError('Provide either `file_path` or `base64_data`.');
|
|
@@ -682,7 +682,7 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
|
|
|
682
682
|
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
683
683
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
684
684
|
}, "strip", import("zod").ZodTypeAny, {
|
|
685
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
685
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
686
686
|
account_id?: string | undefined;
|
|
687
687
|
workspace_id?: string | undefined;
|
|
688
688
|
username?: string | undefined;
|
|
@@ -893,7 +893,7 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
|
|
|
893
893
|
ai_generated: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
894
894
|
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
895
895
|
}, {
|
|
896
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
896
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
897
897
|
account_id?: string | undefined;
|
|
898
898
|
workspace_id?: string | undefined;
|
|
899
899
|
username?: string | undefined;
|
|
@@ -1790,7 +1790,7 @@ export declare const validatePostTool: {
|
|
|
1790
1790
|
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
1791
1791
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1792
1792
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1793
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
1793
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
1794
1794
|
account_id?: string | undefined;
|
|
1795
1795
|
workspace_id?: string | undefined;
|
|
1796
1796
|
username?: string | undefined;
|
|
@@ -2001,7 +2001,7 @@ export declare const validatePostTool: {
|
|
|
2001
2001
|
ai_generated: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
2002
2002
|
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
2003
2003
|
}, {
|
|
2004
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "
|
|
2004
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
2005
2005
|
account_id?: string | undefined;
|
|
2006
2006
|
workspace_id?: string | undefined;
|
|
2007
2007
|
username?: string | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const WEBHOOK_EVENTS: readonly ["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"];
|
|
3
|
-
export declare const webhookEventSchema: z.ZodEnum<["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"]>;
|
|
2
|
+
export declare const WEBHOOK_EVENTS: readonly ["webhook.test", "post.created", "post.updated", "post.deleted", "post.publishing", "post.published", "post.failed", "account.disconnected", "account.needs_reconnect", "account.reconnected", "analytics.synced", "approval.requested", "approval.approved", "approval.changes_requested", "approval.rejected", "approval.commented"];
|
|
3
|
+
export declare const webhookEventSchema: z.ZodEnum<["webhook.test", "post.created", "post.updated", "post.deleted", "post.publishing", "post.published", "post.failed", "account.disconnected", "account.needs_reconnect", "account.reconnected", "analytics.synced", "approval.requested", "approval.approved", "approval.changes_requested", "approval.rejected", "approval.commented"]>;
|