posterly-mcp-server 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +310 -111
- package/dist/index.js +190 -894
- package/dist/lib/alias-transport.d.ts +84 -0
- package/dist/lib/alias-transport.js +193 -0
- package/dist/lib/api-client.d.ts +18 -0
- package/dist/lib/api-client.js +55 -0
- package/dist/lib/preview-token-core.d.ts +62 -0
- package/dist/lib/preview-token-core.js +131 -0
- package/dist/lib/preview-token.d.ts +23 -0
- package/dist/lib/preview-token.js +44 -0
- package/dist/lib/tool-registry.d.ts +246 -0
- package/dist/lib/tool-registry.js +394 -0
- package/dist/lib/tool-runtime.d.ts +68 -0
- package/dist/lib/tool-runtime.js +85 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/tools/audit-google-business-profile.js +1 -1
- package/dist/tools/connect-account.d.ts +4 -4
- package/dist/tools/connect-account.js +2 -2
- package/dist/tools/create-connect-session.d.ts +2 -2
- package/dist/tools/create-connect-session.js +2 -2
- package/dist/tools/create-post.d.ts +6 -6
- package/dist/tools/create-post.js +3 -3
- package/dist/tools/create-posts-batch.d.ts +4 -4
- package/dist/tools/create-webhook.d.ts +2 -2
- package/dist/tools/delete-post.d.ts +34 -10
- package/dist/tools/delete-post.js +52 -16
- package/dist/tools/generate-captions.d.ts +2 -2
- package/dist/tools/generate-image.d.ts +4 -4
- package/dist/tools/generate-image.js +2 -2
- package/dist/tools/generate-video.d.ts +6 -6
- package/dist/tools/generate-video.js +1 -1
- package/dist/tools/get-agent-signup-info.js +2 -2
- package/dist/tools/get-post.d.ts +16 -1
- package/dist/tools/get-post.js +35 -19
- package/dist/tools/list-accounts.d.ts +49 -3
- package/dist/tools/list-accounts.js +148 -33
- package/dist/tools/list-analytics.d.ts +111 -0
- package/dist/tools/list-analytics.js +393 -0
- package/dist/tools/list-brands.d.ts +38 -3
- package/dist/tools/list-brands.js +138 -20
- package/dist/tools/list-comments.d.ts +29 -9
- package/dist/tools/list-comments.js +75 -34
- package/dist/tools/list-conversations.d.ts +32 -9
- package/dist/tools/list-conversations.js +63 -27
- package/dist/tools/list-google-business-media.js +1 -1
- package/dist/tools/list-google-business-reviews.d.ts +32 -9
- package/dist/tools/list-google-business-reviews.js +77 -52
- package/dist/tools/list-jobs.d.ts +60 -0
- package/dist/tools/list-jobs.js +81 -0
- package/dist/tools/list-platforms.d.ts +62 -3
- package/dist/tools/list-platforms.js +118 -9
- package/dist/tools/list-posts.d.ts +2 -2
- package/dist/tools/manage-comment.d.ts +102 -0
- package/dist/tools/manage-comment.js +125 -0
- package/dist/tools/manage-conversation.d.ts +79 -0
- package/dist/tools/manage-conversation.js +75 -0
- package/dist/tools/manage-google-business-media.d.ts +103 -0
- package/dist/tools/manage-google-business-media.js +126 -0
- package/dist/tools/manage-google-business-review.d.ts +146 -0
- package/dist/tools/manage-google-business-review.js +115 -0
- package/dist/tools/manage-oauth-client.d.ts +121 -0
- package/dist/tools/manage-oauth-client.js +94 -0
- package/dist/tools/manage-webhook.d.ts +99 -0
- package/dist/tools/manage-webhook.js +87 -0
- package/dist/tools/start-signup.d.ts +2 -2
- package/dist/tools/submit-agent-feedback.d.ts +4 -4
- package/dist/tools/trigger-platform-helper.d.ts +2 -2
- package/dist/tools/update-post.d.ts +62 -11
- package/dist/tools/update-post.js +79 -26
- package/dist/tools/upload-media.d.ts +32 -9
- package/dist/tools/upload-media.js +54 -18
- package/dist/tools/validate-post.d.ts +4 -4
- package/dist/tools/whoami.d.ts +15 -2
- package/dist/tools/whoami.js +221 -25
- package/package.json +5 -3
- package/scripts/test-alias-transport.mjs +368 -0
- package/scripts/test-client-header-sanitization.mjs +78 -0
- package/scripts/test-tool-annotations.mjs +38 -17
- package/server.json +9 -2
- package/src/index.ts +227 -1443
- package/src/lib/alias-transport.ts +233 -0
- package/src/lib/api-client.ts +65 -0
- package/src/lib/preview-token-core.ts +157 -0
- package/src/lib/preview-token.ts +54 -0
- package/src/lib/tool-registry.ts +538 -0
- package/src/lib/tool-runtime.ts +117 -0
- package/src/lib/version.ts +1 -1
- package/src/tools/audit-google-business-profile.ts +1 -1
- package/src/tools/connect-account.ts +2 -2
- package/src/tools/create-connect-session.ts +2 -2
- package/src/tools/create-post.ts +3 -3
- package/src/tools/delete-post.ts +60 -19
- package/src/tools/generate-image.ts +2 -2
- package/src/tools/generate-video.ts +1 -1
- package/src/tools/get-agent-signup-info.ts +2 -2
- package/src/tools/get-post.ts +35 -21
- package/src/tools/list-accounts.ts +187 -39
- package/src/tools/list-analytics.ts +444 -0
- package/src/tools/list-brands.ts +162 -26
- package/src/tools/list-comments.ts +86 -43
- package/src/tools/list-conversations.ts +81 -39
- package/src/tools/list-google-business-media.ts +1 -1
- package/src/tools/list-google-business-reviews.ts +93 -64
- package/src/tools/list-jobs.ts +91 -0
- package/src/tools/list-platforms.ts +135 -11
- package/src/tools/manage-comment.ts +142 -0
- package/src/tools/manage-conversation.ts +89 -0
- package/src/tools/manage-google-business-media.ts +147 -0
- package/src/tools/manage-google-business-review.ts +139 -0
- package/src/tools/manage-oauth-client.ts +116 -0
- package/src/tools/manage-webhook.ts +103 -0
- package/src/tools/update-post.ts +106 -39
- package/src/tools/upload-media.ts +76 -28
- package/src/tools/whoami.ts +253 -30
- package/tool-annotations.json +76 -149
- package/tool-registry.json +2085 -0
- package/src/tools/add-google-business-media.ts +0 -50
- package/src/tools/create-oauth-client.ts +0 -36
- package/src/tools/delete-comment.ts +0 -29
- package/src/tools/delete-google-business-media.ts +0 -30
- package/src/tools/delete-google-business-review-reply.ts +0 -30
- package/src/tools/delete-oauth-client.ts +0 -23
- package/src/tools/delete-post-group.ts +0 -17
- package/src/tools/delete-webhook.ts +0 -17
- package/src/tools/get-account-analytics.ts +0 -171
- package/src/tools/get-brand-profile.ts +0 -86
- package/src/tools/get-brand.ts +0 -34
- package/src/tools/get-comment.ts +0 -47
- package/src/tools/get-connect-link.ts +0 -61
- package/src/tools/get-connect-session.ts +0 -63
- package/src/tools/get-conversation.ts +0 -44
- package/src/tools/get-google-business-review-link.ts +0 -30
- package/src/tools/get-image-job.ts +0 -36
- package/src/tools/get-learned-voice.ts +0 -31
- package/src/tools/get-mcp-status.ts +0 -212
- package/src/tools/get-performance-profile.ts +0 -47
- package/src/tools/get-platform-schema.ts +0 -56
- package/src/tools/get-post-analytics.ts +0 -243
- package/src/tools/get-post-insights.ts +0 -60
- package/src/tools/get-post-missing.ts +0 -16
- package/src/tools/get-video-job.ts +0 -36
- package/src/tools/list-brand-accounts.ts +0 -36
- package/src/tools/reply-google-business-review.ts +0 -32
- package/src/tools/reply-to-comment.ts +0 -30
- package/src/tools/send-message.ts +0 -28
- package/src/tools/suggest-google-business-review-reply.ts +0 -44
- package/src/tools/sync-inbox.ts +0 -28
- package/src/tools/test-webhook.ts +0 -18
- package/src/tools/update-comment.ts +0 -31
- package/src/tools/update-oauth-client.ts +0 -38
- package/src/tools/update-post-release-id.ts +0 -25
- package/src/tools/update-post-status.ts +0 -31
- package/src/tools/update-webhook.ts +0 -36
- package/src/tools/upload-media-from-url.ts +0 -33
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-call context and shared helpers for the npm stdio tools that merge
|
|
3
|
+
* several old tools (MCP tool consolidation, 0.45.0).
|
|
4
|
+
*
|
|
5
|
+
* - validateArgs(): the registry's per-mode rules (mcp-server/tool-registry.json)
|
|
6
|
+
* run before any request, same as the hosted endpoint
|
|
7
|
+
* - previewThenConfirm(): preview then confirm for public or destructive
|
|
8
|
+
* actions; alias calls (ctx.legacyConfirm) keep their old one-step confirm
|
|
9
|
+
* until the alias sunset date
|
|
10
|
+
*
|
|
11
|
+
* The context is built per call in index.ts from the transport's request map,
|
|
12
|
+
* never stored in the arguments or on shared state.
|
|
13
|
+
*/
|
|
14
|
+
import { type ToolRegistry } from './tool-registry.js';
|
|
15
|
+
import type { StdioPreviewTokens } from './preview-token.js';
|
|
16
|
+
export interface ToolContext {
|
|
17
|
+
/** The name the client called: an alias or the canonical tool. */
|
|
18
|
+
calledName: string;
|
|
19
|
+
/** True for alias calls: confirm: true alone still runs preview actions until the sunset date. */
|
|
20
|
+
legacyConfirm: boolean;
|
|
21
|
+
registry: ToolRegistry;
|
|
22
|
+
previews: StdioPreviewTokens;
|
|
23
|
+
/** The tool sets listed in this process (POSTERLY_TOOLSETS); every set when all is true. */
|
|
24
|
+
toolsets?: {
|
|
25
|
+
enabled: string[];
|
|
26
|
+
all: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates a merged tool's args against the registry's per-mode rules and
|
|
31
|
+
* returns the normalised args and mode. Throws a plain error before any request.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateArgs(ctx: ToolContext, tool: string, input: unknown): {
|
|
34
|
+
mode: string | null;
|
|
35
|
+
args: Record<string, any>;
|
|
36
|
+
};
|
|
37
|
+
/** A shallow copy of args without the given keys. */
|
|
38
|
+
export declare function omitKeys(args: Record<string, any>, keys: string[]): Record<string, any>;
|
|
39
|
+
export interface PreviewStep {
|
|
40
|
+
tool: string;
|
|
41
|
+
action: string;
|
|
42
|
+
/** Validated (normalised) args: the preview and the confirm call must hash identically. */
|
|
43
|
+
args: Record<string, any>;
|
|
44
|
+
/** Public writes: a preview_id can be confirmed once only. */
|
|
45
|
+
nonce: boolean;
|
|
46
|
+
/** The old tool's refusal when confirm is missing, for alias calls. */
|
|
47
|
+
legacyRefusal: string;
|
|
48
|
+
ctx: ToolContext;
|
|
49
|
+
/** What will change (may make one read request; must not throw). */
|
|
50
|
+
describe: () => Promise<string>;
|
|
51
|
+
run: () => Promise<string>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Preview then confirm (docs/mcp-tool-design.md section 4). Canonical calls:
|
|
55
|
+
* no confirm returns a preview and a preview_id bound to this tool, action,
|
|
56
|
+
* and exact args; confirm needs that preview_id. Alias calls keep the old
|
|
57
|
+
* contract until the sunset: confirm: true alone runs the action.
|
|
58
|
+
*/
|
|
59
|
+
export declare function previewThenConfirm(step: PreviewStep): Promise<string>;
|
|
60
|
+
/** Runs one read for a preview; a failed read (for example a 403 on a narrower key) falls back to echoing the request. */
|
|
61
|
+
export declare function readForPreview<T>(read: () => Promise<T>): Promise<{
|
|
62
|
+
ok: true;
|
|
63
|
+
data: T;
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
error: string;
|
|
67
|
+
}>;
|
|
68
|
+
export declare function readFailedNote(error: string): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-call context and shared helpers for the npm stdio tools that merge
|
|
3
|
+
* several old tools (MCP tool consolidation, 0.45.0).
|
|
4
|
+
*
|
|
5
|
+
* - validateArgs(): the registry's per-mode rules (mcp-server/tool-registry.json)
|
|
6
|
+
* run before any request, same as the hosted endpoint
|
|
7
|
+
* - previewThenConfirm(): preview then confirm for public or destructive
|
|
8
|
+
* actions; alias calls (ctx.legacyConfirm) keep their old one-step confirm
|
|
9
|
+
* until the alias sunset date
|
|
10
|
+
*
|
|
11
|
+
* The context is built per call in index.ts from the transport's request map,
|
|
12
|
+
* never stored in the arguments or on shared state.
|
|
13
|
+
*/
|
|
14
|
+
import { canonicalArgs, validateMode } from './tool-registry.js';
|
|
15
|
+
import { previewFailureMessage } from './preview-token-core.js';
|
|
16
|
+
import { code, mdSection, mdTitle } from './format.js';
|
|
17
|
+
/** The local process serves one user; preview tokens are bound to this process's key anyway. */
|
|
18
|
+
const STDIO_PREVIEW_USER = 'stdio-local';
|
|
19
|
+
/**
|
|
20
|
+
* Validates a merged tool's args against the registry's per-mode rules and
|
|
21
|
+
* returns the normalised args and mode. Throws a plain error before any request.
|
|
22
|
+
*/
|
|
23
|
+
export function validateArgs(ctx, tool, input) {
|
|
24
|
+
const validated = validateMode(ctx.registry, tool, input);
|
|
25
|
+
if (!validated.ok)
|
|
26
|
+
throw new Error(validated.error);
|
|
27
|
+
return { mode: validated.mode, args: validated.args };
|
|
28
|
+
}
|
|
29
|
+
/** A shallow copy of args without the given keys. */
|
|
30
|
+
export function omitKeys(args, keys) {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const [key, value] of Object.entries(args || {})) {
|
|
33
|
+
if (!keys.includes(key))
|
|
34
|
+
out[key] = value;
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function formatPreview(body, previewId, tool) {
|
|
39
|
+
return [
|
|
40
|
+
mdTitle('Preview only: nothing has changed yet'),
|
|
41
|
+
body,
|
|
42
|
+
mdSection('Preview ID', `${code(previewId)} (expires in 10 minutes)`),
|
|
43
|
+
mdSection('Next step', `Show this preview to the user. Only after they explicitly approve, call ${tool} again with the same fields plus confirm: true and this preview_id.`),
|
|
44
|
+
].filter(Boolean).join('\n\n');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Preview then confirm (docs/mcp-tool-design.md section 4). Canonical calls:
|
|
48
|
+
* no confirm returns a preview and a preview_id bound to this tool, action,
|
|
49
|
+
* and exact args; confirm needs that preview_id. Alias calls keep the old
|
|
50
|
+
* contract until the sunset: confirm: true alone runs the action.
|
|
51
|
+
*/
|
|
52
|
+
export async function previewThenConfirm(step) {
|
|
53
|
+
const { ctx, args } = step;
|
|
54
|
+
if (ctx.legacyConfirm) {
|
|
55
|
+
if (args.confirm !== true)
|
|
56
|
+
throw new Error(step.legacyRefusal);
|
|
57
|
+
return step.run();
|
|
58
|
+
}
|
|
59
|
+
const binding = { userId: STDIO_PREVIEW_USER, tool: step.tool, action: step.action, args: canonicalArgs(args) };
|
|
60
|
+
if (args.confirm !== true) {
|
|
61
|
+
const previewId = ctx.previews.create(binding);
|
|
62
|
+
return formatPreview(await step.describe(), previewId, step.tool);
|
|
63
|
+
}
|
|
64
|
+
const token = args.preview_id;
|
|
65
|
+
if (typeof token !== 'string' || !token)
|
|
66
|
+
throw new Error(previewFailureMessage('missing'));
|
|
67
|
+
const verified = ctx.previews.verify(token, binding);
|
|
68
|
+
if (!verified.ok)
|
|
69
|
+
throw new Error(previewFailureMessage(verified.reason));
|
|
70
|
+
if (step.nonce && !ctx.previews.claimOnce(token, verified.exp))
|
|
71
|
+
throw new Error(previewFailureMessage('used'));
|
|
72
|
+
return step.run();
|
|
73
|
+
}
|
|
74
|
+
/** Runs one read for a preview; a failed read (for example a 403 on a narrower key) falls back to echoing the request. */
|
|
75
|
+
export async function readForPreview(read) {
|
|
76
|
+
try {
|
|
77
|
+
return { ok: true, data: await read() };
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return { ok: false, error: error?.message || String(error) };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function readFailedNote(error) {
|
|
84
|
+
return `_posterly could not read the current item (${error}), so the preview shows the request as given._`;
|
|
85
|
+
}
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const POSTERLY_MCP_VERSION = "0.
|
|
1
|
+
export declare const POSTERLY_MCP_VERSION = "0.45.0";
|
package/dist/lib/version.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
// tool set (minus the intentional pre-auth signup tools that only this stdio
|
|
6
6
|
// package exposes). `npm run check:mcp-parity` enforces both the version match
|
|
7
7
|
// and the tool-list match, and runs in the pre-commit hook.
|
|
8
|
-
export const POSTERLY_MCP_VERSION = '0.
|
|
8
|
+
export const POSTERLY_MCP_VERSION = '0.45.0';
|
|
@@ -5,7 +5,7 @@ export const auditGoogleBusinessProfileTool = {
|
|
|
5
5
|
inputSchema: z.object({
|
|
6
6
|
workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
|
|
7
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
|
|
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 from list_google_business_reviews view=review_link. Prefer account_id.'),
|
|
9
9
|
}),
|
|
10
10
|
async execute(client, input) {
|
|
11
11
|
const result = await client.auditGoogleBusinessProfile(input);
|
|
@@ -20,13 +20,13 @@ export declare const connectAccountTool: {
|
|
|
20
20
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
21
21
|
connect_session_id: z.ZodOptional<z.ZodString>;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
platform: "telegram" | "bluesky" | "discord" | "
|
|
23
|
+
platform: "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy";
|
|
24
24
|
username?: string | undefined;
|
|
25
25
|
workspace_id?: string | undefined;
|
|
26
26
|
connect_session_id?: string | undefined;
|
|
27
|
-
handle?: string | undefined;
|
|
28
27
|
bot_token?: string | undefined;
|
|
29
28
|
chat_id?: string | undefined;
|
|
29
|
+
handle?: string | undefined;
|
|
30
30
|
app_password?: string | undefined;
|
|
31
31
|
webhook_url?: string | undefined;
|
|
32
32
|
site_url?: string | undefined;
|
|
@@ -35,13 +35,13 @@ export declare const connectAccountTool: {
|
|
|
35
35
|
instance?: string | undefined;
|
|
36
36
|
password?: string | undefined;
|
|
37
37
|
}, {
|
|
38
|
-
platform: "telegram" | "bluesky" | "discord" | "
|
|
38
|
+
platform: "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy";
|
|
39
39
|
username?: string | undefined;
|
|
40
40
|
workspace_id?: string | undefined;
|
|
41
41
|
connect_session_id?: string | undefined;
|
|
42
|
-
handle?: string | undefined;
|
|
43
42
|
bot_token?: string | undefined;
|
|
44
43
|
chat_id?: string | undefined;
|
|
44
|
+
handle?: string | undefined;
|
|
45
45
|
app_password?: string | undefined;
|
|
46
46
|
webhook_url?: string | undefined;
|
|
47
47
|
site_url?: string | undefined;
|
|
@@ -26,7 +26,7 @@ const PLATFORM_CREDENTIAL_FIELDS = {
|
|
|
26
26
|
};
|
|
27
27
|
export const connectAccountTool = {
|
|
28
28
|
name: 'connect_account',
|
|
29
|
-
description: 'Connect a credential-based social account (telegram, bluesky, discord, wordpress, devto, hashnode, lemmy) directly, without a browser session. Call
|
|
29
|
+
description: 'Connect a credential-based social account (telegram, bluesky, discord, wordpress, devto, hashnode, lemmy) directly, without a browser session. Call list_platforms with view=connect_link first to discover the exact credential fields the platform needs. Prefer scoped secrets: app passwords (Bluesky, WordPress), bot tokens (Telegram), webhook URLs (Discord), and API tokens (Dev.to, Hashnode) over primary passwords. Warn the user that any credential they share passes through this conversation. For OAuth platforms (Instagram, X, LinkedIn, ...) use create_connect_session instead.',
|
|
30
30
|
inputSchema: z.object({
|
|
31
31
|
platform: z
|
|
32
32
|
.enum(CREDENTIAL_PLATFORMS)
|
|
@@ -56,7 +56,7 @@ export const connectAccountTool = {
|
|
|
56
56
|
}
|
|
57
57
|
const missing = allowedFields.filter((field) => !(field in credentials));
|
|
58
58
|
if (missing.length > 0) {
|
|
59
|
-
return `Missing credential field(s) for ${input.platform}: ${missing.join(', ')}. Call
|
|
59
|
+
return `Missing credential field(s) for ${input.platform}: ${missing.join(', ')}. Call list_platforms with view=connect_link and target=${input.platform} to see field descriptions.`;
|
|
60
60
|
}
|
|
61
61
|
const result = await client.connectAccountCredentials({
|
|
62
62
|
platform: input.platform,
|
|
@@ -9,12 +9,12 @@ export declare const createConnectSessionTool: {
|
|
|
9
9
|
auto_start: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
platform: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
12
|
+
platform: "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";
|
|
13
13
|
workspace_id?: string | undefined;
|
|
14
14
|
auto_start?: boolean | undefined;
|
|
15
15
|
debug?: boolean | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
platform: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
17
|
+
platform: "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";
|
|
18
18
|
workspace_id?: string | undefined;
|
|
19
19
|
auto_start?: boolean | undefined;
|
|
20
20
|
debug?: boolean | undefined;
|
|
@@ -3,7 +3,7 @@ import { DASHBOARD_CONNECT_URL, formatConnectedAccounts, formatLocalDateTime } f
|
|
|
3
3
|
import { CONNECT_INPUTS } from '../generated/platform-manifest.js';
|
|
4
4
|
export const createConnectSessionTool = {
|
|
5
5
|
name: 'create_connect_session',
|
|
6
|
-
description: 'Create a short-lived posterly dashboard handoff session for connecting a social account. Send the secure connection URL to the user, then poll
|
|
6
|
+
description: 'Create a short-lived posterly dashboard handoff session for connecting a social account. Send the secure connection URL to the user, then poll list_accounts with view=connect_session to narrate progress. Do not ask for social media passwords or OAuth codes; posterly handles those browser steps.',
|
|
7
7
|
inputSchema: z.object({
|
|
8
8
|
platform: z
|
|
9
9
|
.enum(CONNECT_INPUTS)
|
|
@@ -41,7 +41,7 @@ function formatConnectSession(session, includeRaw) {
|
|
|
41
41
|
`Expires: ${formatLocalDateTime(session.expires_at)}`,
|
|
42
42
|
`Dashboard connect page: ${DASHBOARD_CONNECT_URL}`,
|
|
43
43
|
'',
|
|
44
|
-
'Next step for the AI agent: send the secure connection URL to the user, explain that posterly will handle the browser OAuth step, then poll
|
|
44
|
+
'Next step for the AI agent: send the secure connection URL to the user, explain that posterly will handle the browser OAuth step, then poll list_accounts with view=connect_session until the account is connected or the session ends.',
|
|
45
45
|
includeRaw ? `\nRaw connect session:\n${JSON.stringify(session, null, 2)}` : '',
|
|
46
46
|
].filter(Boolean).join('\n');
|
|
47
47
|
}
|
|
@@ -968,7 +968,7 @@ export declare const createPostPayloadInputSchema: z.ZodObject<{
|
|
|
968
968
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
969
969
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
970
970
|
}, "strip", z.ZodTypeAny, {
|
|
971
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
971
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
972
972
|
username?: string | undefined;
|
|
973
973
|
workspace_id?: string | undefined;
|
|
974
974
|
account_id?: string | undefined;
|
|
@@ -1131,7 +1131,7 @@ export declare const createPostPayloadInputSchema: z.ZodObject<{
|
|
|
1131
1131
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
1132
1132
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1133
1133
|
}, {
|
|
1134
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
1134
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
1135
1135
|
username?: string | undefined;
|
|
1136
1136
|
workspace_id?: string | undefined;
|
|
1137
1137
|
account_id?: string | undefined;
|
|
@@ -1787,7 +1787,7 @@ export declare const createPostInputSchema: z.ZodObject<{
|
|
|
1787
1787
|
confirm: z.ZodLiteral<true>;
|
|
1788
1788
|
}, "strip", z.ZodTypeAny, {
|
|
1789
1789
|
confirm: true;
|
|
1790
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
1790
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
1791
1791
|
username?: string | undefined;
|
|
1792
1792
|
workspace_id?: string | undefined;
|
|
1793
1793
|
account_id?: string | undefined;
|
|
@@ -1951,7 +1951,7 @@ export declare const createPostInputSchema: z.ZodObject<{
|
|
|
1951
1951
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1952
1952
|
}, {
|
|
1953
1953
|
confirm: true;
|
|
1954
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
1954
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
1955
1955
|
username?: string | undefined;
|
|
1956
1956
|
workspace_id?: string | undefined;
|
|
1957
1957
|
account_id?: string | undefined;
|
|
@@ -2613,7 +2613,7 @@ export declare const createPostTool: {
|
|
|
2613
2613
|
confirm: z.ZodLiteral<true>;
|
|
2614
2614
|
}, "strip", z.ZodTypeAny, {
|
|
2615
2615
|
confirm: true;
|
|
2616
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
2616
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
2617
2617
|
username?: string | undefined;
|
|
2618
2618
|
workspace_id?: string | undefined;
|
|
2619
2619
|
account_id?: string | undefined;
|
|
@@ -2777,7 +2777,7 @@ export declare const createPostTool: {
|
|
|
2777
2777
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
2778
2778
|
}, {
|
|
2779
2779
|
confirm: true;
|
|
2780
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
2780
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
2781
2781
|
username?: string | undefined;
|
|
2782
2782
|
workspace_id?: string | undefined;
|
|
2783
2783
|
account_id?: string | undefined;
|
|
@@ -151,7 +151,7 @@ export const createPostPayloadInputSchema = z.object({
|
|
|
151
151
|
.describe('For X or Threads only: array of 2+ strings, one per post in the thread. The first entry leads, the rest reply in order. When set, the platform must be twitter or threads.'),
|
|
152
152
|
instagram_settings: instagramSettingsSchema
|
|
153
153
|
.optional()
|
|
154
|
-
.describe('Instagram-specific settings. If “tag” is ambiguous, distinguish caption @mentions (put @username in caption), native media tags (user_tags), and co-author invitations (collaborators). Native media tags work with eligible direct or Meta-linked accounts; collaborators require an eligible Meta-linked account. Call
|
|
154
|
+
.describe('Instagram-specific settings. If “tag” is ambiguous, distinguish caption @mentions (put @username in caption), native media tags (user_tags), and co-author invitations (collaborators). Native media tags work with eligible direct or Meta-linked accounts; collaborators require an eligible Meta-linked account. Call list_platforms with view=schema and account_id first.'),
|
|
155
155
|
platform_settings: platformSettingsSchema
|
|
156
156
|
.optional()
|
|
157
157
|
.describe('Platform-specific settings for the selected account. Use this for non-Instagram settings and prefer it over raw metadata.'),
|
|
@@ -218,9 +218,9 @@ export const createPostTool = {
|
|
|
218
218
|
'4. If scheduling multiple posts in one turn, list every post first and confirm the batch as a whole, then prefer `create_posts_batch` so they are created in one API request.\n\n' +
|
|
219
219
|
'AFTER CALLING: Tell the user the post was created, include the posterly dashboard link returned by the tool, and offer the next natural action. Do not narrate raw HTTP, curl, or API plumbing.\n\n' +
|
|
220
220
|
'Provide either account_id OR username+platform to identify the account. If scheduled_at is omitted, the post publishes immediately. If workspace_id is omitted, the server resolves one from the social account, falling back to the caller\'s default (personal) workspace - pass workspace_id explicitly if the user has more than one workspace.\n\n' +
|
|
221
|
-
'MEDIA URLS: Posterly storage URLs are used as-is. Third-party HTTP(S) media URLs are copied into posterly storage before the post is saved, so API-created posts do not later fail on expired signed URLs. Short-lived signed URLs must still be live when this tool runs. You can also call `
|
|
221
|
+
'MEDIA URLS: Posterly storage URLs are used as-is. Third-party HTTP(S) media URLs are copied into posterly storage before the post is saved, so API-created posts do not later fail on expired signed URLs. Short-lived signed URLs must still be live when this tool runs. You can also call `upload_media` with `url` first if you want to upload once and reuse the returned posterly URL across posts.\n\n' +
|
|
222
222
|
'THREADS: Pass `thread_posts` (an array of 2+ strings) to schedule a multi-post thread on X (Twitter) or Threads (Meta). The first entry is the lead post; the rest are published as replies in the same chain. X entries are capped at 280 characters each (4000 for verified, 25000 for organization accounts); Threads entries are capped at 500 characters each. When `thread_posts` is set, `caption` is ignored.\n\n' +
|
|
223
|
-
'PLATFORM SETTINGS: Pass `platform_settings` for composer-equivalent controls: Facebook story/reel/backgrounds, YouTube title/privacy/thumbnail/brandPartner, LinkedIn document titles/mentions/polls/content_call_to_action_label (including BUY_NOW and SHOP_NOW), TikTok direct-post privacy/toggles/commercial disclosure, Pinterest board/title/link/product_tags, GBP event/offer/CTA/recurrence, X reply settings/polls/paid_partnership, Threads reply controls/text attachments/ghost posts/spoilers/reply approvals/GIPHY, Telegram polls/buttons/video cover/live photo, Slack markdown/blocks, Mastodon visibility/quote/poll (media+poll allowed), and Instagram feed/story/reel/carousel/native media tags/collaborators/first comments/trial Reels/is_ai_generated/audio_id. For Instagram, @username in caption is only a caption mention; `user_tags` creates native media tags and `collaborators` sends co-author invitations only when the selected Meta-linked account reports those capabilities. Call `
|
|
223
|
+
'PLATFORM SETTINGS: Pass `platform_settings` for composer-equivalent controls: Facebook story/reel/backgrounds, YouTube title/privacy/thumbnail/brandPartner, LinkedIn document titles/mentions/polls/content_call_to_action_label (including BUY_NOW and SHOP_NOW), TikTok direct-post privacy/toggles/commercial disclosure, Pinterest board/title/link/product_tags, GBP event/offer/CTA/recurrence, X reply settings/polls/paid_partnership, Threads reply controls/text attachments/ghost posts/spoilers/reply approvals/GIPHY, Telegram polls/buttons/video cover/live photo, Slack markdown/blocks, Mastodon visibility/quote/poll (media+poll allowed), and Instagram feed/story/reel/carousel/native media tags/collaborators/first comments/trial Reels/is_ai_generated/audio_id. For Instagram, @username in caption is only a caption mention; `user_tags` creates native media tags and `collaborators` sends co-author invitations only when the selected Meta-linked account reports those capabilities. Call `list_platforms` with `view: "schema"` and the account ID first. `instagram_settings` remains as a backwards-compatible alias.\n\n' +
|
|
224
224
|
'TIKTOK MEDIA: TikTok supports a single video or a photo slideshow of 1 to 35 images, never multiple videos. Image media auto-detects as a slideshow, so you usually do not set post_type or media_type for photos and every image is posted. Pass `platform_settings.media_type: "PHOTO"` to force a slideshow explicitly.',
|
|
225
225
|
inputSchema: createPostInputSchema,
|
|
226
226
|
async execute(client, input) {
|
|
@@ -495,7 +495,7 @@ export declare const createPostsBatchTool: {
|
|
|
495
495
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
496
496
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
497
497
|
}, "strip", z.ZodTypeAny, {
|
|
498
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
498
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
499
499
|
username?: string | undefined;
|
|
500
500
|
workspace_id?: string | undefined;
|
|
501
501
|
account_id?: string | undefined;
|
|
@@ -658,7 +658,7 @@ export declare const createPostsBatchTool: {
|
|
|
658
658
|
ai_generated: z.ZodOptional<z.ZodBoolean>;
|
|
659
659
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
660
660
|
}, {
|
|
661
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
661
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
662
662
|
username?: string | undefined;
|
|
663
663
|
workspace_id?: string | undefined;
|
|
664
664
|
account_id?: string | undefined;
|
|
@@ -825,7 +825,7 @@ export declare const createPostsBatchTool: {
|
|
|
825
825
|
}, "strip", z.ZodTypeAny, {
|
|
826
826
|
confirm: true;
|
|
827
827
|
posts: {
|
|
828
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
828
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
829
829
|
username?: string | undefined;
|
|
830
830
|
workspace_id?: string | undefined;
|
|
831
831
|
account_id?: string | undefined;
|
|
@@ -991,7 +991,7 @@ export declare const createPostsBatchTool: {
|
|
|
991
991
|
}, {
|
|
992
992
|
confirm: true;
|
|
993
993
|
posts: {
|
|
994
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "
|
|
994
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "x" | "telegram" | "bluesky" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
995
995
|
username?: string | undefined;
|
|
996
996
|
workspace_id?: string | undefined;
|
|
997
997
|
account_id?: string | undefined;
|
|
@@ -15,15 +15,15 @@ export declare const createWebhookTool: {
|
|
|
15
15
|
url: string;
|
|
16
16
|
description?: string | undefined;
|
|
17
17
|
workspace_id?: string | undefined;
|
|
18
|
-
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
19
18
|
is_active?: boolean | undefined;
|
|
19
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
20
20
|
}, {
|
|
21
21
|
confirm: true;
|
|
22
22
|
url: string;
|
|
23
23
|
description?: string | undefined;
|
|
24
24
|
workspace_id?: string | undefined;
|
|
25
|
-
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
26
25
|
is_active?: boolean | undefined;
|
|
26
|
+
events?: ("webhook.test" | "post.created" | "post.updated" | "post.deleted" | "post.publishing" | "post.published" | "post.failed" | "account.disconnected" | "analytics.synced" | "approval.requested" | "approval.approved" | "approval.changes_requested" | "approval.rejected" | "approval.commented")[] | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
execute(client: PosterlyClient, input: {
|
|
29
29
|
url: string;
|
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { PosterlyClient } from '../lib/api-client.js';
|
|
3
|
+
import { type ToolContext } from '../lib/tool-runtime.js';
|
|
4
|
+
type DeletePostInput = {
|
|
5
|
+
post_id?: number;
|
|
6
|
+
group_id?: string;
|
|
7
|
+
confirm?: boolean;
|
|
8
|
+
preview_id?: string;
|
|
9
|
+
};
|
|
3
10
|
export declare const deletePostTool: {
|
|
4
11
|
name: string;
|
|
5
12
|
description: string;
|
|
6
13
|
inputSchema: z.ZodObject<{
|
|
7
|
-
post_id: z.ZodNumber
|
|
8
|
-
|
|
14
|
+
post_id: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
group_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
preview_id: z.ZodOptional<z.ZodString>;
|
|
9
18
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
confirm
|
|
11
|
-
|
|
19
|
+
confirm?: boolean | undefined;
|
|
20
|
+
preview_id?: string | undefined;
|
|
21
|
+
post_id?: number | undefined;
|
|
22
|
+
group_id?: string | undefined;
|
|
12
23
|
}, {
|
|
13
|
-
confirm
|
|
14
|
-
|
|
24
|
+
confirm?: boolean | undefined;
|
|
25
|
+
preview_id?: string | undefined;
|
|
26
|
+
post_id?: number | undefined;
|
|
27
|
+
group_id?: string | undefined;
|
|
15
28
|
}>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
30
|
+
legacySchemas: {
|
|
31
|
+
delete_post_group: z.ZodObject<{
|
|
32
|
+
group_id: z.ZodString;
|
|
33
|
+
confirm: z.ZodLiteral<true>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
confirm: true;
|
|
36
|
+
group_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
confirm: true;
|
|
39
|
+
group_id: string;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
execute(client: PosterlyClient, input: DeletePostInput, ctx: ToolContext): Promise<string>;
|
|
20
43
|
};
|
|
44
|
+
export {};
|
|
@@ -1,24 +1,60 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { dashboardUrlForPosts } from '../lib/format.js';
|
|
2
|
+
import { code, dashboardUrlForPosts } from '../lib/format.js';
|
|
3
|
+
import { previewThenConfirm, validateArgs } from '../lib/tool-runtime.js';
|
|
3
4
|
export const deletePostTool = {
|
|
4
5
|
name: 'delete_post',
|
|
5
|
-
description: 'Delete
|
|
6
|
-
'REQUIRED BEFORE CALLING: Fetch the post with `get_post` first and show the user what will be deleted (caption, account, scheduled time). Get explicit confirmation ("yes delete it", "remove it") before calling. Never delete multiple posts in a single batch without listing each one and confirming the full list.',
|
|
6
|
+
description: 'Delete posts. DESTRUCTIVE and IRREVERSIBLE: deleted posts and captions cannot be recovered, and published or currently publishing posts are never deleted. post_id: delete one scheduled or draft post; fetch it with `get_post` first, show the user what will be deleted (caption, account, scheduled time), and pass confirm=true only after explicit confirmation ("yes delete it", "remove it"). group_id: delete every draft, scheduled, failed, or paused post matching a caller-defined group_id, post_group_id, api_group_id, or release_id; preview then confirm: call without confirm to get a preview and preview_id, show it, then call again with confirm=true and that preview_id. Never delete several posts one by one without listing each and confirming the full list.',
|
|
7
7
|
inputSchema: z.object({
|
|
8
|
-
post_id: z.number().describe('
|
|
9
|
-
|
|
8
|
+
post_id: z.number().optional().describe('Delete this one post.'),
|
|
9
|
+
group_id: z.string().min(1).max(160).optional().describe('Delete every unpublished post in this group or release instead.'),
|
|
10
|
+
confirm: z
|
|
11
|
+
.boolean()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('post_id: true after explicit user confirmation of the deletion. group_id: leave out to get a preview; true only with the preview_id after the user approved it.'),
|
|
14
|
+
preview_id: z.string().optional().describe('group_id: the preview_id from the preview call. Required with confirm: true.'),
|
|
10
15
|
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
17
|
+
legacySchemas: {
|
|
18
|
+
delete_post_group: z.object({
|
|
19
|
+
group_id: z.string().min(1).max(160),
|
|
20
|
+
confirm: z.literal(true),
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
async execute(client, input, ctx) {
|
|
24
|
+
const { mode, args } = validateArgs(ctx, 'delete_post', input);
|
|
25
|
+
if (mode === 'group') {
|
|
26
|
+
return previewThenConfirm({
|
|
27
|
+
tool: 'delete_post',
|
|
28
|
+
action: 'group',
|
|
29
|
+
args,
|
|
30
|
+
nonce: false,
|
|
31
|
+
legacyRefusal: 'Refusing to delete post group without confirm=true after explicit user confirmation.',
|
|
32
|
+
ctx,
|
|
33
|
+
// GET /api/v1/posts has no group filter, so the preview says in plain
|
|
34
|
+
// words which posts match instead of listing them.
|
|
35
|
+
describe: async () => [
|
|
36
|
+
`Deletes every draft, scheduled, failed, or paused post whose group_id, post_group_id, api_group_id, or release_id is ${code(args.group_id)}. Published posts are never deleted. This cannot be undone.`,
|
|
37
|
+
'To see the posts first, call list_posts and check each post\'s group or release ID.',
|
|
38
|
+
].join('\n\n'),
|
|
39
|
+
run: async () => {
|
|
40
|
+
const result = await client.deletePostGroup(args.group_id);
|
|
41
|
+
return JSON.stringify(result, null, 2);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
14
44
|
}
|
|
15
|
-
|
|
16
|
-
return [
|
|
17
|
-
`Post #${result.id} deleted successfully.`,
|
|
18
|
-
'It has been removed from the posterly queue.',
|
|
19
|
-
`View queue in posterly: ${dashboardUrlForPosts()}`,
|
|
20
|
-
'',
|
|
21
|
-
'Next step for the AI agent: tell the user the post is gone and offer to create, reschedule, or review the next post.',
|
|
22
|
-
].join('\n');
|
|
45
|
+
return deleteOne(client, args);
|
|
23
46
|
},
|
|
24
47
|
};
|
|
48
|
+
async function deleteOne(client, input) {
|
|
49
|
+
if (input.confirm !== true) {
|
|
50
|
+
throw new Error('Refusing to delete post without confirm=true after explicit user confirmation.');
|
|
51
|
+
}
|
|
52
|
+
const result = await client.deletePost(input.post_id);
|
|
53
|
+
return [
|
|
54
|
+
`Post #${result.id} deleted successfully.`,
|
|
55
|
+
'It has been removed from the posterly queue.',
|
|
56
|
+
`View queue in posterly: ${dashboardUrlForPosts()}`,
|
|
57
|
+
'',
|
|
58
|
+
'Next step for the AI agent: tell the user the post is gone and offer to create, reschedule, or review the next post.',
|
|
59
|
+
].join('\n');
|
|
60
|
+
}
|
|
@@ -35,12 +35,12 @@ export declare const generateCaptionsTool: {
|
|
|
35
35
|
platforms: ("instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business")[];
|
|
36
36
|
workspace_id?: string | undefined;
|
|
37
37
|
count?: number | undefined;
|
|
38
|
+
mode?: "generate" | "adapt" | undefined;
|
|
38
39
|
social_account_id?: string | undefined;
|
|
39
40
|
brief?: string | undefined;
|
|
40
41
|
tone?: string | undefined;
|
|
41
42
|
allow_emojis?: boolean | undefined;
|
|
42
43
|
hashtag_strategy?: "none" | "smart" | "minimal" | "aggressive" | undefined;
|
|
43
|
-
mode?: "generate" | "adapt" | undefined;
|
|
44
44
|
source_caption?: string | undefined;
|
|
45
45
|
source_platform?: "instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | undefined;
|
|
46
46
|
preserve_links?: boolean | undefined;
|
|
@@ -55,12 +55,12 @@ export declare const generateCaptionsTool: {
|
|
|
55
55
|
platforms: ("instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business")[];
|
|
56
56
|
workspace_id?: string | undefined;
|
|
57
57
|
count?: number | undefined;
|
|
58
|
+
mode?: "generate" | "adapt" | undefined;
|
|
58
59
|
social_account_id?: string | undefined;
|
|
59
60
|
brief?: string | undefined;
|
|
60
61
|
tone?: string | undefined;
|
|
61
62
|
allow_emojis?: boolean | undefined;
|
|
62
63
|
hashtag_strategy?: "none" | "smart" | "minimal" | "aggressive" | undefined;
|
|
63
|
-
mode?: "generate" | "adapt" | undefined;
|
|
64
64
|
source_caption?: string | undefined;
|
|
65
65
|
source_platform?: "instagram" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | undefined;
|
|
66
66
|
preserve_links?: boolean | undefined;
|
|
@@ -20,10 +20,10 @@ export declare const generateImageTool: {
|
|
|
20
20
|
prompt: string;
|
|
21
21
|
provider?: "google" | "xai" | undefined;
|
|
22
22
|
aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "1:4" | "1:8" | "21:9" | "4:1" | "8:1" | "5:4" | undefined;
|
|
23
|
+
resolution?: "512" | "1K" | "2K" | "4K" | undefined;
|
|
24
|
+
model?: "pro" | "lite" | "flash" | undefined;
|
|
23
25
|
style?: "minimal" | "professional" | "photographic" | "illustration" | "vibrant" | "youtube_thumbnail" | "reel_cover" | "review_background" | undefined;
|
|
24
26
|
variations?: number | undefined;
|
|
25
|
-
model?: "pro" | "lite" | "flash" | undefined;
|
|
26
|
-
resolution?: "512" | "1K" | "2K" | "4K" | undefined;
|
|
27
27
|
quality?: "low" | "medium" | "high" | undefined;
|
|
28
28
|
thinking_level?: "minimal" | "high" | undefined;
|
|
29
29
|
reference_image_urls?: string[] | undefined;
|
|
@@ -32,10 +32,10 @@ export declare const generateImageTool: {
|
|
|
32
32
|
prompt: string;
|
|
33
33
|
provider?: "google" | "xai" | undefined;
|
|
34
34
|
aspect_ratio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "4:5" | "1:4" | "1:8" | "21:9" | "4:1" | "8:1" | "5:4" | undefined;
|
|
35
|
+
resolution?: "512" | "1K" | "2K" | "4K" | undefined;
|
|
36
|
+
model?: "pro" | "lite" | "flash" | undefined;
|
|
35
37
|
style?: "minimal" | "professional" | "photographic" | "illustration" | "vibrant" | "youtube_thumbnail" | "reel_cover" | "review_background" | undefined;
|
|
36
38
|
variations?: number | undefined;
|
|
37
|
-
model?: "pro" | "lite" | "flash" | undefined;
|
|
38
|
-
resolution?: "512" | "1K" | "2K" | "4K" | undefined;
|
|
39
39
|
quality?: "low" | "medium" | "high" | undefined;
|
|
40
40
|
thinking_level?: "minimal" | "high" | undefined;
|
|
41
41
|
reference_image_urls?: string[] | undefined;
|