@posty5/mcp 2.0.0 → 2.2.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.
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  import { QrPrintPresets, QR_PRINT_DPI_VALUES, presetWidthMm, QR_PRINT_DPI_DEFAULT } from '@posty5/qr-design';
6
6
  import { randomUUID, createHash } from 'crypto';
7
7
  import { AuthenticationError, AuthorizationError, NotFoundError, RateLimitError, ConflictError, VersionRequiredError, ValidationError, NetworkError, ServerError, Posty5Error, Posty5BulkCreateError, LINK_BULK_TERMINAL_STATUSES, HttpClient } from '@posty5/core';
8
- import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS, SocialPublisherPostClient } from '@posty5/social-publisher-post';
8
+ import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS_TOTAL, MAX_POST_COMMENTS_PER_PLATFORM, SocialPublisherPostClient } from '@posty5/social-publisher-post';
9
9
  import { AccountClient } from '@posty5/account';
10
10
  import { HtmlHostingClient } from '@posty5/html-hosting';
11
11
  import { HtmlHostingFormSubmissionClient } from '@posty5/html-hosting-form-submission';
@@ -109,7 +109,7 @@ function selectTools(all, toolsets, access) {
109
109
  // src/config/instructions.config.ts
110
110
  var SERVER_NAME = "posty5";
111
111
  var SERVER_TITLE = "Posty5";
112
- var PACKAGE_VERSION = "2.0.0";
112
+ var PACKAGE_VERSION = "2.2.0";
113
113
  var SERVER_INSTRUCTIONS = [
114
114
  "Posty5 is a platform for short links, QR codes, hosted HTML pages and social media publishing. These tools act on the Posty5 account this connection belongs to.",
115
115
  "Start with account_get_current to see which account and plan you are working with.",
@@ -1668,9 +1668,11 @@ var SOCIAL_POST_STATUSES = [
1668
1668
  "retrying",
1669
1669
  "removing",
1670
1670
  "removed",
1671
- "removeFailed"
1671
+ "removeFailed",
1672
+ "partiallyRemoved"
1672
1673
  ];
1673
1674
  var SOCIAL_POST_PLATFORMS = ["youtube", "facebook", "instagram", "tiktok"];
1675
+ var SOCIAL_POST_REMOVE_PLATFORMS = ["youtube", "facebook", "instagram", "tiktok", "threads", "twitter"];
1674
1676
  var VIDEO_PLATFORM_BLOCKS = ["youtube", "tiktok", "facebook", "instagram"];
1675
1677
  var SOCIAL_POST_TARGETS = ["workspaceId", "accountId"];
1676
1678
  var TIKTOK_PRIVACY_LEVELS = ["PUBLIC_TO_EVERYONE", "FOLLOWER_OF_CREATOR", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY"];
@@ -1690,6 +1692,8 @@ var IMAGE_CAPTION_MAX_LENGTH = 8e3;
1690
1692
  var YOUTUBE_TITLE_MAX_LENGTH = 100;
1691
1693
  var THREADS_TEXT_MAX_LENGTH = 500;
1692
1694
  var TWITTER_TEXT_MAX_WEIGHTED_LENGTH = 280;
1695
+ var MAX_WORKSPACE_DEFAULT_COMMENTS = 10;
1696
+ var COMMENT_POST_TYPES = ["shortVideo", "longVideo", "image", "text"];
1693
1697
 
1694
1698
  // src/core/social-publisher.helper.ts
1695
1699
  function toScheduleConfig(scheduledAt) {
@@ -1713,6 +1717,7 @@ function videoPublishOptions(args) {
1713
1717
  facebook: args.facebook,
1714
1718
  instagram: args.instagram,
1715
1719
  comment: args.comment,
1720
+ allowPostDefaultComments: args.allowPostDefaultComments,
1716
1721
  schedule: args.scheduledAt ? new Date(args.scheduledAt) : void 0,
1717
1722
  tag: args.tag,
1718
1723
  refId: args.refId
@@ -1779,7 +1784,19 @@ var commentsField = z.array(
1779
1784
  imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook only."),
1780
1785
  ...commentFlags
1781
1786
  })
1782
- ).max(MAX_POST_COMMENTS).optional().describe(`Up to ${MAX_POST_COMMENTS} comments posted under the post once it is live, in order. Each is charged separately; see account_get_operation_costs.`);
1787
+ ).max(MAX_POST_COMMENTS_TOTAL).optional().describe(`Up to ${MAX_POST_COMMENTS_PER_PLATFORM} comments per platform (${MAX_POST_COMMENTS_TOTAL} in all), posted under the post once it is live, in order. Each is charged separately; see account_get_operation_costs.`);
1788
+ var allowDefaultCommentsField = z.boolean().optional().describe(
1789
+ "Add the saved default comments (default true): a workspace's defaults for this post type plus account defaults marked applyToWorkspacePosts, or an account's own. They are added after `comments` and charged like any other comment. Send false to add none \u2014 do so when you already put the defaults you want into `comments` (social_workspace_resolve_default_comments lists them)."
1790
+ );
1791
+ var workspaceDefaultCommentField = z.object({
1792
+ _id: z.string().optional().describe("Send it back to edit this default; omit it to add one."),
1793
+ text: z.string().min(1).max(MAX_COMMENT_LENGTH),
1794
+ delayMinutes: z.number().int().min(0).max(MAX_COMMENT_DELAY_MINUTES).optional().describe("Minutes to wait after the post is live. Default 0."),
1795
+ imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook and Threads only."),
1796
+ isActive: z.boolean().optional().describe("An inactive default is kept but never added. Default true."),
1797
+ postTypes: z.array(z.enum(COMMENT_POST_TYPES)).optional().describe("The post types it is added to. Empty or absent: all of them."),
1798
+ ...commentFlags
1799
+ });
1783
1800
  var videoPostFields = {
1784
1801
  ...targetFields2,
1785
1802
  videoUrl: z.string().url().describe("A direct, public URL of the video file (.mp4, .mov, .avi, .mkv or .webm). Files cannot be uploaded through this tool."),
@@ -1789,6 +1806,7 @@ var videoPostFields = {
1789
1806
  facebook: facebookBlock,
1790
1807
  instagram: instagramBlock,
1791
1808
  comment: videoCommentField,
1809
+ allowPostDefaultComments: allowDefaultCommentsField,
1792
1810
  scheduledAt: scheduledAtField,
1793
1811
  ...labelFields2
1794
1812
  };
@@ -1827,6 +1845,42 @@ var SOCIAL_PUBLISHER_TOOLS = [
1827
1845
  input: z.object({ id: idField(WORKSPACE_ID) }),
1828
1846
  run: ({ id }, { clients }) => clients.workspaces.getForNewPost(id)
1829
1847
  }),
1848
+ defineTool({
1849
+ name: "social_workspace_get_default_comments",
1850
+ toolset: "social-publisher",
1851
+ access: "read",
1852
+ title: "Workspace default comments",
1853
+ description: "The comments every new post to this workspace starts with, in order, each with the post types it applies to (empty = all) and its platforms. Read the workspace's __v with social_workspace_get before changing them.",
1854
+ input: z.object({ id: idField(WORKSPACE_ID) }),
1855
+ run: async ({ id }, { clients }) => ({ comments: await clients.workspaces.getDefaultComments(id) })
1856
+ }),
1857
+ defineTool({
1858
+ name: "social_workspace_resolve_default_comments",
1859
+ toolset: "social-publisher",
1860
+ access: "read",
1861
+ title: "Preview a new post's default comments",
1862
+ description: "The default comments a new post of postType to this workspace would get right now: the workspace's own for that type, then account defaults marked applyToWorkspacePosts, aimed only at platforms the workspace has accounts on. warnings lists any dropped at a platform's ceiling. To publish an edited list, pass it as the post's comments with allowPostDefaultComments: false.",
1863
+ input: z.object({ id: idField(WORKSPACE_ID), postType: z.enum(COMMENT_POST_TYPES) }),
1864
+ run: ({ id, postType }, { clients }) => clients.workspaces.resolveDefaultComments(id, postType)
1865
+ }),
1866
+ defineTool({
1867
+ name: "social_workspace_set_default_comments",
1868
+ toolset: "social-publisher",
1869
+ access: "write",
1870
+ title: "Set workspace default comments",
1871
+ description: `Replaces the workspace's default comments with this list (at most ${MAX_WORKSPACE_DEFAULT_COMMENTS}); an empty list clears them. New posts to the workspace then get them automatically unless the publish call sends allowPostDefaultComments: false, and every added comment is charged like any other. Existing and scheduled posts keep the comments they already have.`,
1872
+ input: z.object({
1873
+ id: idField(WORKSPACE_ID),
1874
+ version: versionField("the workspace"),
1875
+ comments: z.array(workspaceDefaultCommentField).max(MAX_WORKSPACE_DEFAULT_COMMENTS)
1876
+ }),
1877
+ annotations: { idempotent: true },
1878
+ run: async ({ id, version, comments }, { clients }) => {
1879
+ const saved = await clients.workspaces.setDefaultComments(id, comments, version);
1880
+ return { updated: true, id, __v: saved.__v, comments: saved.comments };
1881
+ },
1882
+ entity: (_result, args) => ({ entityType: "socialWorkspace", entityId: args.id })
1883
+ }),
1830
1884
  defineTool({
1831
1885
  name: "social_account_list",
1832
1886
  toolset: "social-publisher",
@@ -1969,6 +2023,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
1969
2023
  facebook: facebookBlock,
1970
2024
  instagram: instagramBlock,
1971
2025
  comments: commentsField,
2026
+ allowPostDefaultComments: allowDefaultCommentsField,
1972
2027
  scheduledAt: scheduledAtField,
1973
2028
  ...labelFields2
1974
2029
  }),
@@ -2055,6 +2110,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
2055
2110
  reply_settings: z.enum(TWITTER_REPLY_SETTINGS).optional()
2056
2111
  }).optional().describe("X override."),
2057
2112
  comments: commentsField,
2113
+ allowPostDefaultComments: allowDefaultCommentsField,
2058
2114
  scheduledAt: scheduledAtField,
2059
2115
  ...labelFields2
2060
2116
  }),
@@ -2134,19 +2190,23 @@ var SOCIAL_PUBLISHER_TOOLS = [
2134
2190
  toolset: "social-publisher",
2135
2191
  access: "full",
2136
2192
  title: "Remove a post from the platforms",
2137
- description: "Deletes a published post's media from the platforms it was published to, at once. Instagram and TikTok offer no delete through their APIs, so media there stays. Irreversible. Paid, only when the removal succeeds: the price is in account_get_operation_costs.",
2138
- input: z.object({ id: idField(POST_ID), version: versionField("the post") }),
2193
+ description: "Deletes a published post's media from the platforms it was published to, at once, or from one platform when `platform` is given (the others keep their copies and the post becomes partiallyRemoved). Instagram and TikTok offer no delete through their APIs, so media there stays. Irreversible. Paid, only when the removal succeeds: the price is in account_get_operation_costs.",
2194
+ input: z.object({
2195
+ id: idField(POST_ID),
2196
+ version: versionField("the post"),
2197
+ platform: z.enum(SOCIAL_POST_REMOVE_PLATFORMS).optional().describe("Remove from this platform only. The post must have been published there. Omit to remove from every platform.")
2198
+ }),
2139
2199
  annotations: { destructive: true, idempotent: true },
2140
2200
  confirm: {
2141
- describe: async ({ id }, { clients }) => {
2201
+ describe: async ({ id, platform }, { clients }) => {
2142
2202
  const post = await clients.posts.getStatus(id);
2143
- const platforms = postPlatforms(post);
2203
+ const platforms = platform ? [platform] : postPlatforms(post);
2144
2204
  const where = platforms.length ? platforms.join(", ") : "the platforms it was published to";
2145
2205
  return `Remove post #${post.numbering} from ${where}. The published media is deleted from those platforms immediately, and this is irreversible \u2014 it cannot be restored or re-published from here. Instagram and TikTok offer no delete through their APIs, so media there stays.`;
2146
2206
  },
2147
2207
  costFeaturePath: "socialMediaPublisher.removePost"
2148
2208
  },
2149
- run: ({ id, version }, { clients }) => clients.posts.removePost(id, version),
2209
+ run: ({ id, version, platform }, { clients }) => clients.posts.removePost(id, version, platform),
2150
2210
  entity: (_result, args) => ({ entityType: "socialPost", entityId: args.id })
2151
2211
  })
2152
2212
  ];