posterly-mcp-server 0.54.6 → 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 +45 -4
- 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 +148 -0
- package/dist/lib/api-client.js +84 -0
- package/dist/lib/claude-directory-profile.js +3 -1
- 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 +4 -0
- package/dist/lib/google-business-review-name.js +11 -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.js +13 -3
- package/dist/tools/list-conversations.d.ts +4 -4
- package/dist/tools/list-conversations.js +10 -5
- 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 +3 -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 +29 -3
- 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 +239 -8
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { PosterlyClient } from '../lib/api-client.js';
|
|
3
|
+
import { type ToolContext } from '../lib/tool-runtime.js';
|
|
4
|
+
export declare const listGoogleBusinessServiceAreasTool: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: z.ZodObject<{
|
|
8
|
+
view: z.ZodOptional<z.ZodEnum<["areas", "places"]>>;
|
|
9
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
10
|
+
account_id: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
location_id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
q: z.ZodOptional<z.ZodString>;
|
|
13
|
+
region_code: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
account_id?: number | undefined;
|
|
16
|
+
workspace_id?: string | undefined;
|
|
17
|
+
location_id?: string | undefined;
|
|
18
|
+
q?: string | undefined;
|
|
19
|
+
region_code?: string | undefined;
|
|
20
|
+
view?: "areas" | "places" | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
account_id?: number | undefined;
|
|
23
|
+
workspace_id?: string | undefined;
|
|
24
|
+
location_id?: string | undefined;
|
|
25
|
+
q?: string | undefined;
|
|
26
|
+
region_code?: string | undefined;
|
|
27
|
+
view?: "areas" | "places" | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
execute(client: PosterlyClient, input: {
|
|
30
|
+
view?: "areas" | "places";
|
|
31
|
+
workspace_id?: string;
|
|
32
|
+
account_id?: number;
|
|
33
|
+
location_id?: string;
|
|
34
|
+
q?: string;
|
|
35
|
+
region_code?: string;
|
|
36
|
+
}, ctx: ToolContext): Promise<string>;
|
|
37
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { formatGoogleBusinessServiceArea, formatGoogleBusinessServiceAreaPlaces } from '../lib/service-area-text.js';
|
|
3
|
+
import { validateArgs } from '../lib/tool-runtime.js';
|
|
4
|
+
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.';
|
|
5
|
+
export const listGoogleBusinessServiceAreasTool = {
|
|
6
|
+
name: 'list_google_business_service_areas',
|
|
7
|
+
description: 'Read Google Business service areas (the towns and postcodes a location covers, up to 20). view=areas (default): the current business type, country, and place list for one location. view=places (q required): search for a town or postcode to add. Place IDs from view=places are regions, not the review-link Place ID. Town search needs a maps key on the server; if it is missing, add a place with its Place ID and name on the update instead.',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
view: z.enum(['areas', 'places']).optional().describe('areas (default) or places (search).'),
|
|
10
|
+
workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
|
|
11
|
+
account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts. Required for view=areas.'),
|
|
12
|
+
location_id: z.string().optional().describe(LOCATION_ID_DESCRIPTION),
|
|
13
|
+
q: z.string().min(2).optional().describe('places: town or postcode to search for.'),
|
|
14
|
+
region_code: z.string().optional().describe('places: optional two-letter country code, for example GB.'),
|
|
15
|
+
}),
|
|
16
|
+
async execute(client, input, ctx) {
|
|
17
|
+
const { mode, args } = validateArgs(ctx, 'list_google_business_service_areas', input);
|
|
18
|
+
if (mode === 'places') {
|
|
19
|
+
const result = await client.searchGoogleBusinessServiceAreaPlaces({
|
|
20
|
+
workspace_id: args.workspace_id,
|
|
21
|
+
q: args.q,
|
|
22
|
+
region_code: args.region_code,
|
|
23
|
+
});
|
|
24
|
+
return formatGoogleBusinessServiceAreaPlaces(result);
|
|
25
|
+
}
|
|
26
|
+
const result = await client.getGoogleBusinessServiceArea({
|
|
27
|
+
workspace_id: args.workspace_id,
|
|
28
|
+
account_id: args.account_id,
|
|
29
|
+
location_id: args.location_id,
|
|
30
|
+
});
|
|
31
|
+
return formatGoogleBusinessServiceArea(result);
|
|
32
|
+
},
|
|
33
|
+
};
|
package/dist/tools/list-media.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { formatPagingNote } from '../lib/format.js';
|
|
3
3
|
export const listMediaTool = {
|
|
4
4
|
name: 'list_media',
|
|
5
|
-
description: 'List the newest media assets for the authenticated user. After create_media_drop, pass drop_session_id to see files the human uploaded on /drop/<token>. Use public_url with validate_post / create_post. A drop listing returns up to 20 files per page by default so a full drop fits one page. The output says whether every matching file is shown; page with offset (offset + limit up to 1000) when it is not.',
|
|
5
|
+
description: 'List the newest media assets for the authenticated user. After create_media_drop, pass drop_session_id to see files the human uploaded on /drop/<token>. Each file includes its filename and the time it was added. Use public_url with validate_post / create_post. A drop listing returns up to 20 files per page by default so a full drop fits one page. The output says whether every matching file is shown; page with offset (offset + limit up to 1000) when it is not.',
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
limit: z
|
|
8
8
|
.number()
|
|
@@ -37,7 +37,8 @@ export const listMediaTool = {
|
|
|
37
37
|
const lines = result.media.map((item) => {
|
|
38
38
|
const size = typeof item.bytes === 'number' ? `${item.bytes} bytes` : 'unknown size';
|
|
39
39
|
const drop = item.drop_session_id ? ` drop=${item.drop_session_id}` : '';
|
|
40
|
-
|
|
40
|
+
const added = item.created_at ? `, added ${item.created_at}` : '';
|
|
41
|
+
return `• ${item.filename} (${item.mime || 'unknown'}, ${size}${added})${drop}\n public_url: ${item.public_url}`;
|
|
41
42
|
});
|
|
42
43
|
const offset = result.offset ?? input.offset ?? 0;
|
|
43
44
|
return [
|
|
@@ -22,21 +22,21 @@ export declare const listPlatformsTool: {
|
|
|
22
22
|
include_planned: z.ZodOptional<z.ZodBoolean>;
|
|
23
23
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
25
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
26
26
|
account_id?: string | undefined;
|
|
27
27
|
workspace_id?: string | undefined;
|
|
28
28
|
include_planned?: boolean | undefined;
|
|
29
|
-
view?: "
|
|
29
|
+
view?: "schema" | "platforms" | "connect_link" | undefined;
|
|
30
30
|
debug?: boolean | undefined;
|
|
31
|
-
target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
31
|
+
target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
|
|
32
32
|
}, {
|
|
33
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
33
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
34
34
|
account_id?: string | undefined;
|
|
35
35
|
workspace_id?: string | undefined;
|
|
36
36
|
include_planned?: boolean | undefined;
|
|
37
|
-
view?: "
|
|
37
|
+
view?: "schema" | "platforms" | "connect_link" | undefined;
|
|
38
38
|
debug?: boolean | undefined;
|
|
39
|
-
target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
39
|
+
target?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
|
|
40
40
|
}>;
|
|
41
41
|
/** The old tools' exact input schemas, for alias calls (see alias-transport.ts). */
|
|
42
42
|
legacySchemas: {
|
|
@@ -45,11 +45,11 @@ export declare const listPlatformsTool: {
|
|
|
45
45
|
platform: z.ZodOptional<z.ZodEnum<["bluesky", "devto", "discord", "facebook", "gmb", "google-business", "google_business", "google_business_profile", "hashnode", "instagram", "instagram-standalone", "lemmy", "linkedin", "mastodon", "medium", "pinterest", "reddit", "skool", "slack", "telegram", "threads", "tiktok", "twitter", "whop", "wordpress", "x", "youtube"]>>;
|
|
46
46
|
include_planned: z.ZodOptional<z.ZodBoolean>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
48
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
49
49
|
account_id?: string | undefined;
|
|
50
50
|
include_planned?: boolean | undefined;
|
|
51
51
|
}, {
|
|
52
|
-
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
52
|
+
platform?: "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | undefined;
|
|
53
53
|
account_id?: string | undefined;
|
|
54
54
|
include_planned?: boolean | undefined;
|
|
55
55
|
}>;
|
|
@@ -59,12 +59,12 @@ export declare const listPlatformsTool: {
|
|
|
59
59
|
include_planned: z.ZodOptional<z.ZodBoolean>;
|
|
60
60
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
platform?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
62
|
+
platform?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
|
|
63
63
|
workspace_id?: string | undefined;
|
|
64
64
|
include_planned?: boolean | undefined;
|
|
65
65
|
debug?: boolean | undefined;
|
|
66
66
|
}, {
|
|
67
|
-
platform?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "
|
|
67
|
+
platform?: "meta" | "instagram_direct" | "instagram" | "instagram-standalone" | "facebook" | "tiktok" | "twitter" | "threads" | "linkedin" | "youtube" | "pinterest" | "google_business" | "medium" | "x" | "bluesky" | "telegram" | "discord" | "wordpress" | "devto" | "hashnode" | "lemmy" | "slack" | "mastodon" | "reddit" | "skool" | "whop" | "gmb" | "google-business" | "google_business_profile" | "linkedin_page" | "facebook_instagram" | "facebook_pages" | "linkedin-company" | "linkedin-page" | "linkedin_company" | "linkedin_personal" | "meta_business" | "x_twitter" | undefined;
|
|
68
68
|
workspace_id?: string | undefined;
|
|
69
69
|
include_planned?: boolean | undefined;
|
|
70
70
|
debug?: boolean | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { formatPagingNote, mdTitle, mdSection, mdKeyValue, mdEmpty
|
|
2
|
+
import { formatPagingNote, mdTitle, mdSection, mdKeyValue, mdEmpty } from '../lib/format.js';
|
|
3
3
|
export const listPostSuggestionsTool = {
|
|
4
4
|
name: 'list_post_suggestions',
|
|
5
|
-
description: "List proactive post suggestions: evidence-based weekly drafts posterly writes in each account's learned voice, each with a rationale tying it back to what has performed well for that account. Filter by account_id and status (pending, scheduled, dismissed; default pending). The output says whether every matching suggestion is shown; page with offset until it does. Read-only; requires a Pro plan or higher. Use dismiss_suggestion to hide one.",
|
|
5
|
+
description: "List proactive post suggestions: evidence-based weekly drafts posterly writes in each account's learned voice, each with a rationale tying it back to what has performed well for that account. The caption, rationale, and account id are returned in full. Filter by account_id and status (pending, scheduled, dismissed; default pending). The output says whether every matching suggestion is shown; page with offset until it does. Read-only; requires a Pro plan or higher. Use dismiss_suggestion to hide one, or pass save_as_draft true on that tool to keep it as an unpublished draft.",
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
account_id: z
|
|
8
8
|
.union([z.string(), z.number()])
|
|
@@ -27,10 +27,11 @@ export const listPostSuggestionsTool = {
|
|
|
27
27
|
: `account ${suggestion.social_account_id}`;
|
|
28
28
|
return mdSection(label, mdKeyValue([
|
|
29
29
|
['Suggestion ID', suggestion.id],
|
|
30
|
+
['Account ID', String(suggestion.social_account_id)],
|
|
30
31
|
['Status', suggestion.status],
|
|
31
32
|
['Period', suggestion.period_key || undefined],
|
|
32
|
-
['Caption',
|
|
33
|
-
['Rationale', suggestion.rationale ?
|
|
33
|
+
['Caption', suggestion.caption.replace(/\s+/g, ' ').trim()],
|
|
34
|
+
['Rationale', suggestion.rationale ? suggestion.rationale.replace(/\s+/g, ' ').trim() : undefined],
|
|
34
35
|
]));
|
|
35
36
|
});
|
|
36
37
|
const note = formatPagingNote({
|
|
@@ -14,6 +14,8 @@ export declare const listPostsTool: {
|
|
|
14
14
|
inputSchema: z.ZodObject<{
|
|
15
15
|
view: z.ZodOptional<z.ZodEnum<["list", "counts"]>>;
|
|
16
16
|
status: z.ZodOptional<z.ZodString>;
|
|
17
|
+
group_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
release_id: z.ZodOptional<z.ZodString>;
|
|
17
19
|
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"]>>;
|
|
18
20
|
account_id: z.ZodOptional<z.ZodString>;
|
|
19
21
|
scheduled_from: z.ZodOptional<z.ZodString>;
|
|
@@ -28,7 +30,9 @@ export declare const listPostsTool: {
|
|
|
28
30
|
brand_id: z.ZodOptional<z.ZodString>;
|
|
29
31
|
}, "strip", z.ZodTypeAny, {
|
|
30
32
|
status?: string | undefined;
|
|
31
|
-
|
|
33
|
+
group_id?: string | undefined;
|
|
34
|
+
release_id?: string | undefined;
|
|
35
|
+
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;
|
|
32
36
|
account_id?: string | undefined;
|
|
33
37
|
workspace_id?: string | undefined;
|
|
34
38
|
approval_status?: "none" | "pending_client" | "approved" | "changes_requested" | "rejected" | undefined;
|
|
@@ -43,7 +47,9 @@ export declare const listPostsTool: {
|
|
|
43
47
|
view?: "list" | "counts" | undefined;
|
|
44
48
|
}, {
|
|
45
49
|
status?: string | undefined;
|
|
46
|
-
|
|
50
|
+
group_id?: string | undefined;
|
|
51
|
+
release_id?: string | undefined;
|
|
52
|
+
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;
|
|
47
53
|
account_id?: string | undefined;
|
|
48
54
|
workspace_id?: string | undefined;
|
|
49
55
|
approval_status?: "none" | "pending_client" | "approved" | "changes_requested" | "rejected" | undefined;
|
package/dist/tools/list-posts.js
CHANGED
|
@@ -3,7 +3,7 @@ import { dashboardUrlForPostList, formatPostCounts, formatPostListPage } from '.
|
|
|
3
3
|
import { validateArgs } from '../lib/tool-runtime.js';
|
|
4
4
|
import { SUPPORTED_PLATFORM_INPUTS, SUPPORTED_PLATFORM_IDS } from '../generated/platform-manifest.js';
|
|
5
5
|
export const LIST_POSTS_DESCRIPTION = 'Posts in your workspaces, teammates\' too, per your role there (brand-locked seats only see their assigned brands). If workspace_id is omitted, this searches every workspace you belong to. ' +
|
|
6
|
-
'view=list (default): posts filtered by status (scheduled, published, failed,
|
|
6
|
+
'view=list (default): posts filtered by status (draft, scheduled, publishing, processing, awaiting_tiktok_publish, awaiting_manual, published, failed, paused, paused_due_to_token, paused_due_to_billing, or missed), platform, account_id, workspace_id, brand_id, group_id, release_id, approval_status, approval_waiting_on, and a scheduled date range: scheduled_from (inclusive) and scheduled_to (a plain date includes that whole day), read in timezone (IANA, default UTC; also the zone times are shown in). status=missed is posts that failed, scheduled posts whose scheduled time is already past, and posts a publishing pause held past their time. group_id matches the caller group (including post_group_id). release_id matches that release only. Returns limit posts (default 20, max 200) starting at offset; with a date range the order defaults to oldest first (order=asc|desc). ' +
|
|
7
7
|
'The output always says whether every matching post was shown. If it says more are available, call again with the offset it gives and keep paging until all are shown before drawing any conclusion about totals, gaps, or how busy a client is. ' +
|
|
8
8
|
'view=counts (scheduled_from and scheduled_to required, up to 366 days): exact totals per day, status, account, and brand for the same filters (limit, offset, and order are ignored); use it for "how many" or "is this month full" questions. ' +
|
|
9
9
|
'Each post includes approval.pending_client_approval.';
|
|
@@ -18,7 +18,15 @@ export const listPostsTool = {
|
|
|
18
18
|
status: z
|
|
19
19
|
.string()
|
|
20
20
|
.optional()
|
|
21
|
-
.describe('
|
|
21
|
+
.describe('Stored post status (draft, scheduled, publishing, processing, awaiting_tiktok_publish, awaiting_manual, published, failed, paused, paused_due_to_token, paused_due_to_billing, or missed). paused_due_to_token is a reconnect pause and paused_due_to_billing is a billing pause. missed: failed, still scheduled after the scheduled time, or held by a publishing pause past it.'),
|
|
22
|
+
group_id: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Caller group id. Matches api_group_id, group_id, and post_group_id.'),
|
|
26
|
+
release_id: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Caller release id. Matches release_id only.'),
|
|
22
30
|
platform: z
|
|
23
31
|
.enum(SUPPORTED_PLATFORM_INPUTS)
|
|
24
32
|
.optional()
|
|
@@ -92,6 +100,8 @@ export const listPostsTool = {
|
|
|
92
100
|
function postFilters(input) {
|
|
93
101
|
return {
|
|
94
102
|
status: input.status,
|
|
103
|
+
group_id: input.group_id,
|
|
104
|
+
release_id: input.release_id,
|
|
95
105
|
platform: input.platform,
|
|
96
106
|
account_id: input.account_id,
|
|
97
107
|
workspace_id: input.workspace_id,
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { PosterlyClient } from '../lib/api-client.js';
|
|
3
|
+
import { type ToolContext } from '../lib/tool-runtime.js';
|
|
3
4
|
export declare const listWebhooksTool: {
|
|
4
5
|
name: string;
|
|
5
6
|
description: string;
|
|
6
7
|
inputSchema: z.ZodObject<{
|
|
8
|
+
view: z.ZodOptional<z.ZodEnum<["webhooks", "deliveries"]>>;
|
|
7
9
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
10
|
+
webhook_id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
13
|
}, "strip", z.ZodTypeAny, {
|
|
9
14
|
workspace_id?: string | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
offset?: number | undefined;
|
|
17
|
+
view?: "webhooks" | "deliveries" | undefined;
|
|
18
|
+
webhook_id?: string | undefined;
|
|
10
19
|
}, {
|
|
11
20
|
workspace_id?: string | undefined;
|
|
21
|
+
limit?: number | undefined;
|
|
22
|
+
offset?: number | undefined;
|
|
23
|
+
view?: "webhooks" | "deliveries" | undefined;
|
|
24
|
+
webhook_id?: string | undefined;
|
|
12
25
|
}>;
|
|
13
26
|
execute(client: PosterlyClient, input: {
|
|
27
|
+
view?: "webhooks" | "deliveries";
|
|
14
28
|
workspace_id?: string;
|
|
15
|
-
|
|
29
|
+
webhook_id?: string;
|
|
30
|
+
limit?: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}, ctx: ToolContext): Promise<string>;
|
|
16
33
|
};
|
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { validateArgs } from '../lib/tool-runtime.js';
|
|
2
3
|
export const listWebhooksTool = {
|
|
3
4
|
name: 'list_webhooks',
|
|
4
|
-
description: 'List API webhook subscriptions, their event filters, active state, and most recent delivery status.',
|
|
5
|
+
description: 'List API webhook subscriptions, their event filters, active state, and most recent delivery status. view=deliveries (webhook_id) reads recent delivery attempts for one webhook. That history stays off until it is switched on, and it does not include the signing secret or the request body.',
|
|
5
6
|
inputSchema: z.object({
|
|
7
|
+
view: z.enum(['webhooks', 'deliveries']).optional().describe('webhooks (default) or deliveries.'),
|
|
6
8
|
workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
|
|
9
|
+
webhook_id: z.string().optional().describe('deliveries: webhook ID from view=webhooks.'),
|
|
10
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
11
|
+
offset: z.number().int().min(0).optional(),
|
|
7
12
|
}),
|
|
8
|
-
async execute(client, input) {
|
|
9
|
-
const {
|
|
13
|
+
async execute(client, input, ctx) {
|
|
14
|
+
const { mode, args } = validateArgs(ctx, 'list_webhooks', input);
|
|
15
|
+
if (mode === 'deliveries') {
|
|
16
|
+
const result = await client.listWebhookDeliveries(String(args.webhook_id), { limit: args.limit, offset: args.offset });
|
|
17
|
+
if (result.enabled !== true)
|
|
18
|
+
return 'Webhook delivery history is switched off. Nothing was read.';
|
|
19
|
+
const deliveries = Array.isArray(result.deliveries) ? result.deliveries : [];
|
|
20
|
+
if (deliveries.length === 0)
|
|
21
|
+
return 'No deliveries found for this webhook.';
|
|
22
|
+
const lines = [`Deliveries (${deliveries.length}):`];
|
|
23
|
+
for (const delivery of deliveries) {
|
|
24
|
+
lines.push(`- ${delivery.id} ${delivery.event_type || ''} ${delivery.status || ''} HTTP ${delivery.http_status ?? 'n/a'} at ${delivery.delivered_at || delivery.created_at || 'n/a'}`);
|
|
25
|
+
}
|
|
26
|
+
return lines.join('\n');
|
|
27
|
+
}
|
|
28
|
+
const { webhooks } = await client.listWebhooks({ workspace_id: args.workspace_id });
|
|
10
29
|
if (webhooks.length === 0) {
|
|
11
30
|
return 'No webhooks found.';
|
|
12
31
|
}
|
|
@@ -25,12 +25,14 @@ export function formatApiAccess(member) {
|
|
|
25
25
|
function formatWorkspaceMembers(result) {
|
|
26
26
|
const members = result.members || [];
|
|
27
27
|
const invites = result.invites || [];
|
|
28
|
+
const showUserId = members.some((member) => member.user_id);
|
|
28
29
|
return [
|
|
29
30
|
mdTitle(`Team (${members.length} members, ${invites.length} pending invites)`, `Workspace ${result.workspace_id}`),
|
|
30
31
|
mdSection('Members', members.length > 0
|
|
31
|
-
? mdTable(['Name', 'Member ID', 'Email', 'Role', 'Status', 'Brands', 'API access'], members.map((member) => [
|
|
32
|
+
? mdTable(['Name', 'Member ID', ...(showUserId ? ['User ID'] : []), 'Email', 'Role', 'Status', 'Brands', 'API access'], members.map((member) => [
|
|
32
33
|
member.name || member.email || member.id,
|
|
33
34
|
code(member.id),
|
|
35
|
+
...(showUserId ? [member.user_id ? code(String(member.user_id)) : 'n/a'] : []),
|
|
34
36
|
member.email,
|
|
35
37
|
member.role,
|
|
36
38
|
member.status,
|
|
@@ -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 ManageBrandsInput = {
|
|
5
|
+
action: 'create' | 'update' | 'archive';
|
|
6
|
+
brand_id?: string;
|
|
7
|
+
workspace_id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
timezone?: string;
|
|
10
|
+
website_url?: string | null;
|
|
11
|
+
confirm?: boolean;
|
|
12
|
+
preview_id?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const manageBrandsTool: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: z.ZodObject<{
|
|
18
|
+
action: z.ZodEnum<["create", "update", "archive"]>;
|
|
19
|
+
brand_id: z.ZodOptional<z.ZodString>;
|
|
20
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
21
|
+
name: z.ZodOptional<z.ZodString>;
|
|
22
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
23
|
+
website_url: z.ZodOptional<z.ZodString>;
|
|
24
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
preview_id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
action: "update" | "create" | "archive";
|
|
28
|
+
workspace_id?: string | undefined;
|
|
29
|
+
brand_id?: string | undefined;
|
|
30
|
+
timezone?: string | undefined;
|
|
31
|
+
confirm?: boolean | undefined;
|
|
32
|
+
preview_id?: string | undefined;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
website_url?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
action: "update" | "create" | "archive";
|
|
37
|
+
workspace_id?: string | undefined;
|
|
38
|
+
brand_id?: string | undefined;
|
|
39
|
+
timezone?: string | undefined;
|
|
40
|
+
confirm?: boolean | undefined;
|
|
41
|
+
preview_id?: string | undefined;
|
|
42
|
+
name?: string | undefined;
|
|
43
|
+
website_url?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
execute(client: PosterlyClient, input: ManageBrandsInput, ctx: ToolContext): Promise<string>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { code, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
|
|
3
|
+
import { previewThenConfirm, validateArgs } from '../lib/tool-runtime.js';
|
|
4
|
+
const BRAND_WRITE_DESCRIPTION = 'Create, update, or archive a brand. action=create (admin only): name, and the workspace_id from whoami when the key is not already scoped to one workspace. Optional timezone and website_url. Pass confirm=true only after the user agrees. action=update (admin only): brand_id plus name, timezone, or website_url. Pass confirm=true only after the user agrees. action=archive (admin only): preview then confirm. Call without confirm to see the brand and what archiving does, show that to the user, then call again with confirm=true and the preview_id. Archiving removes the brand from the active list. Connected accounts stay connected, and its scheduled posts are not cancelled: they still publish. The preview counts both.';
|
|
5
|
+
function formatBrand(result) {
|
|
6
|
+
if (result.requires_confirmation && result.preview) {
|
|
7
|
+
const preview = result.preview;
|
|
8
|
+
return [
|
|
9
|
+
mdTitle('Preview only: the brand is not archived yet'),
|
|
10
|
+
preview.effect || '',
|
|
11
|
+
mdSection('Brand', mdKeyValue([
|
|
12
|
+
['Name', preview.name],
|
|
13
|
+
['Brand ID', preview.brand_id ? code(preview.brand_id) : ''],
|
|
14
|
+
['Accounts still connected', preview.account_count ?? 'could not be counted'],
|
|
15
|
+
['Scheduled posts that still publish', preview.scheduled_post_count ?? 'could not be counted'],
|
|
16
|
+
['Status', preview.status],
|
|
17
|
+
])),
|
|
18
|
+
].filter(Boolean).join('\n\n');
|
|
19
|
+
}
|
|
20
|
+
const brand = result.brand || {};
|
|
21
|
+
return [
|
|
22
|
+
mdTitle(result.already_archived ? `Brand already archived: ${brand.name || 'brand'}` : `Brand: ${brand.name || 'updated'}`),
|
|
23
|
+
mdKeyValue([
|
|
24
|
+
['Brand ID', brand.id ? code(brand.id) : ''],
|
|
25
|
+
['Status', brand.status],
|
|
26
|
+
['Timezone', brand.timezone],
|
|
27
|
+
['Website', brand.website_url],
|
|
28
|
+
['Workspace', brand.workspace_id ? code(brand.workspace_id) : ''],
|
|
29
|
+
]),
|
|
30
|
+
].join('\n\n');
|
|
31
|
+
}
|
|
32
|
+
export const manageBrandsTool = {
|
|
33
|
+
name: 'manage_brand',
|
|
34
|
+
description: BRAND_WRITE_DESCRIPTION,
|
|
35
|
+
inputSchema: z.object({
|
|
36
|
+
action: z.enum(['create', 'update', 'archive']).describe('create, update, or archive.'),
|
|
37
|
+
brand_id: z.string().optional().describe('update and archive: the brand ID from list_brands.'),
|
|
38
|
+
workspace_id: z.string().optional().describe('create: workspace ID from whoami, when the key is not already scoped.'),
|
|
39
|
+
name: z.string().optional().describe('create: required. update: the new name.'),
|
|
40
|
+
timezone: z.string().optional().describe('create or update: an IANA timezone such as Europe/London.'),
|
|
41
|
+
website_url: z.string().optional().describe('create or update: an http or https website. Pass an empty string on update to clear it.'),
|
|
42
|
+
confirm: z.boolean().optional().describe('create and update: true only after the user agrees. archive: true only with the preview_id from a preview call.'),
|
|
43
|
+
preview_id: z.string().optional().describe('archive: the preview_id from the preview call.'),
|
|
44
|
+
}),
|
|
45
|
+
async execute(client, input, ctx) {
|
|
46
|
+
const { mode, args } = validateArgs(ctx, 'manage_brand', input);
|
|
47
|
+
const parsed = args;
|
|
48
|
+
if (mode === 'update') {
|
|
49
|
+
if (parsed.confirm !== true)
|
|
50
|
+
throw new Error('Refusing to update a brand without confirm=true after the user agrees.');
|
|
51
|
+
if (!parsed.brand_id)
|
|
52
|
+
throw new Error('brand_id is required.');
|
|
53
|
+
const result = await client.updateBrand(parsed.brand_id, {
|
|
54
|
+
confirm: true,
|
|
55
|
+
...(parsed.name !== undefined ? { name: parsed.name } : {}),
|
|
56
|
+
...(parsed.timezone !== undefined ? { timezone: parsed.timezone } : {}),
|
|
57
|
+
...(parsed.website_url !== undefined ? { website_url: parsed.website_url } : {}),
|
|
58
|
+
});
|
|
59
|
+
return formatBrand(result);
|
|
60
|
+
}
|
|
61
|
+
if (mode === 'archive') {
|
|
62
|
+
if (!parsed.brand_id)
|
|
63
|
+
throw new Error('brand_id is required.');
|
|
64
|
+
const brandId = parsed.brand_id;
|
|
65
|
+
return previewThenConfirm({
|
|
66
|
+
tool: 'manage_brand',
|
|
67
|
+
action: 'archive',
|
|
68
|
+
args: parsed,
|
|
69
|
+
nonce: false,
|
|
70
|
+
legacyRefusal: 'Refusing to archive a brand without confirm=true after the user agrees.',
|
|
71
|
+
ctx,
|
|
72
|
+
describe: async () => formatBrand(await client.archiveBrand(brandId, { confirm: false })),
|
|
73
|
+
run: async () => formatBrand(await client.archiveBrand(brandId, { confirm: true })),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (parsed.confirm !== true)
|
|
77
|
+
throw new Error('Refusing to create a brand without confirm=true after the user agrees.');
|
|
78
|
+
if (!parsed.name?.trim())
|
|
79
|
+
throw new Error('name is required.');
|
|
80
|
+
const result = await client.createBrand({
|
|
81
|
+
name: parsed.name.trim(),
|
|
82
|
+
confirm: true,
|
|
83
|
+
...(parsed.workspace_id ? { workspace_id: parsed.workspace_id } : {}),
|
|
84
|
+
...(parsed.timezone ? { timezone: parsed.timezone } : {}),
|
|
85
|
+
...(parsed.website_url ? { website_url: parsed.website_url } : {}),
|
|
86
|
+
});
|
|
87
|
+
return formatBrand(result);
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { code, mdKeyValue, mdQuote, mdSection } from '../lib/format.js';
|
|
2
|
+
import { code, inboxCommentContext, mdKeyValue, mdQuote, mdSection } from '../lib/format.js';
|
|
3
3
|
import { previewThenConfirm, readFailedNote, readForPreview, validateArgs } from '../lib/tool-runtime.js';
|
|
4
4
|
export const manageCommentTool = {
|
|
5
5
|
name: 'manage_comment',
|
|
@@ -77,10 +77,14 @@ async function describeComment(client, input) {
|
|
|
77
77
|
return [readFailedNote(read.error), mdKeyValue([['Comment ID', code(input.comment_id)], ['Workspace', input.workspace_id ? code(input.workspace_id) : undefined]])].join('\n\n');
|
|
78
78
|
}
|
|
79
79
|
const comment = read.data.comment;
|
|
80
|
+
const context = inboxCommentContext(comment);
|
|
80
81
|
return mdSection('Comment', mdKeyValue([
|
|
81
82
|
['Comment ID', code(String(comment.id))],
|
|
82
83
|
['Platform', typeof comment.platform === 'string' ? comment.platform : 'unknown'],
|
|
84
|
+
...(context.accountId ? [['Account ID', context.accountId]] : []),
|
|
83
85
|
['Author', typeof comment.author_username === 'string' ? `@${comment.author_username}` : 'unknown'],
|
|
86
|
+
...(context.caption ? [['Post', context.caption]] : []),
|
|
87
|
+
...(context.link ? [['Post link', context.link]] : []),
|
|
84
88
|
['Content', typeof comment.content === 'string' ? comment.content : '(empty)'],
|
|
85
89
|
]));
|
|
86
90
|
}
|