@posty5/mcp 2.1.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.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  import { QrPrintPresets, QR_PRINT_DPI_VALUES, presetWidthMm, QR_PRINT_DPI_DEFAULT } from '@posty5/qr-design';
4
4
  import { randomUUID, timingSafeEqual, createHmac, createHash } from 'crypto';
5
5
  import { AuthorizationError, Posty5BulkCreateError, LINK_BULK_TERMINAL_STATUSES, AuthenticationError, NotFoundError, RateLimitError, ConflictError, VersionRequiredError, ValidationError, NetworkError, ServerError, Posty5Error, HttpClient } from '@posty5/core';
6
- import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS, SocialPublisherPostClient } from '@posty5/social-publisher-post';
6
+ import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS_TOTAL, MAX_POST_COMMENTS_PER_PLATFORM, SocialPublisherPostClient } from '@posty5/social-publisher-post';
7
7
  import { AccountClient } from '@posty5/account';
8
8
  import { HtmlHostingClient } from '@posty5/html-hosting';
9
9
  import { HtmlHostingFormSubmissionClient } from '@posty5/html-hosting-form-submission';
@@ -75,7 +75,7 @@ var MS_PER_MINUTE = 60 * 1e3;
75
75
  // src/config/instructions.config.ts
76
76
  var SERVER_NAME = "posty5";
77
77
  var SERVER_TITLE = "Posty5";
78
- var PACKAGE_VERSION = "2.0.0";
78
+ var PACKAGE_VERSION = "2.2.0";
79
79
  var SERVER_INSTRUCTIONS = [
80
80
  "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.",
81
81
  "Start with account_get_current to see which account and plan you are working with.",
@@ -1669,6 +1669,8 @@ var IMAGE_CAPTION_MAX_LENGTH = 8e3;
1669
1669
  var YOUTUBE_TITLE_MAX_LENGTH = 100;
1670
1670
  var THREADS_TEXT_MAX_LENGTH = 500;
1671
1671
  var TWITTER_TEXT_MAX_WEIGHTED_LENGTH = 280;
1672
+ var MAX_WORKSPACE_DEFAULT_COMMENTS = 10;
1673
+ var COMMENT_POST_TYPES = ["shortVideo", "longVideo", "image", "text"];
1672
1674
 
1673
1675
  // src/core/social-publisher.helper.ts
1674
1676
  function toScheduleConfig(scheduledAt) {
@@ -1692,6 +1694,7 @@ function videoPublishOptions(args) {
1692
1694
  facebook: args.facebook,
1693
1695
  instagram: args.instagram,
1694
1696
  comment: args.comment,
1697
+ allowPostDefaultComments: args.allowPostDefaultComments,
1695
1698
  schedule: args.scheduledAt ? new Date(args.scheduledAt) : void 0,
1696
1699
  tag: args.tag,
1697
1700
  refId: args.refId
@@ -1758,7 +1761,19 @@ var commentsField = z.array(
1758
1761
  imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook only."),
1759
1762
  ...commentFlags
1760
1763
  })
1761
- ).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.`);
1764
+ ).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.`);
1765
+ var allowDefaultCommentsField = z.boolean().optional().describe(
1766
+ "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)."
1767
+ );
1768
+ var workspaceDefaultCommentField = z.object({
1769
+ _id: z.string().optional().describe("Send it back to edit this default; omit it to add one."),
1770
+ text: z.string().min(1).max(MAX_COMMENT_LENGTH),
1771
+ delayMinutes: z.number().int().min(0).max(MAX_COMMENT_DELAY_MINUTES).optional().describe("Minutes to wait after the post is live. Default 0."),
1772
+ imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook and Threads only."),
1773
+ isActive: z.boolean().optional().describe("An inactive default is kept but never added. Default true."),
1774
+ postTypes: z.array(z.enum(COMMENT_POST_TYPES)).optional().describe("The post types it is added to. Empty or absent: all of them."),
1775
+ ...commentFlags
1776
+ });
1762
1777
  var videoPostFields = {
1763
1778
  ...targetFields2,
1764
1779
  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."),
@@ -1768,6 +1783,7 @@ var videoPostFields = {
1768
1783
  facebook: facebookBlock,
1769
1784
  instagram: instagramBlock,
1770
1785
  comment: videoCommentField,
1786
+ allowPostDefaultComments: allowDefaultCommentsField,
1771
1787
  scheduledAt: scheduledAtField,
1772
1788
  ...labelFields2
1773
1789
  };
@@ -1806,6 +1822,42 @@ var SOCIAL_PUBLISHER_TOOLS = [
1806
1822
  input: z.object({ id: idField(WORKSPACE_ID) }),
1807
1823
  run: ({ id }, { clients }) => clients.workspaces.getForNewPost(id)
1808
1824
  }),
1825
+ defineTool({
1826
+ name: "social_workspace_get_default_comments",
1827
+ toolset: "social-publisher",
1828
+ access: "read",
1829
+ title: "Workspace default comments",
1830
+ 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.",
1831
+ input: z.object({ id: idField(WORKSPACE_ID) }),
1832
+ run: async ({ id }, { clients }) => ({ comments: await clients.workspaces.getDefaultComments(id) })
1833
+ }),
1834
+ defineTool({
1835
+ name: "social_workspace_resolve_default_comments",
1836
+ toolset: "social-publisher",
1837
+ access: "read",
1838
+ title: "Preview a new post's default comments",
1839
+ 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.",
1840
+ input: z.object({ id: idField(WORKSPACE_ID), postType: z.enum(COMMENT_POST_TYPES) }),
1841
+ run: ({ id, postType }, { clients }) => clients.workspaces.resolveDefaultComments(id, postType)
1842
+ }),
1843
+ defineTool({
1844
+ name: "social_workspace_set_default_comments",
1845
+ toolset: "social-publisher",
1846
+ access: "write",
1847
+ title: "Set workspace default comments",
1848
+ 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.`,
1849
+ input: z.object({
1850
+ id: idField(WORKSPACE_ID),
1851
+ version: versionField("the workspace"),
1852
+ comments: z.array(workspaceDefaultCommentField).max(MAX_WORKSPACE_DEFAULT_COMMENTS)
1853
+ }),
1854
+ annotations: { idempotent: true },
1855
+ run: async ({ id, version, comments }, { clients }) => {
1856
+ const saved = await clients.workspaces.setDefaultComments(id, comments, version);
1857
+ return { updated: true, id, __v: saved.__v, comments: saved.comments };
1858
+ },
1859
+ entity: (_result, args) => ({ entityType: "socialWorkspace", entityId: args.id })
1860
+ }),
1809
1861
  defineTool({
1810
1862
  name: "social_account_list",
1811
1863
  toolset: "social-publisher",
@@ -1948,6 +2000,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
1948
2000
  facebook: facebookBlock,
1949
2001
  instagram: instagramBlock,
1950
2002
  comments: commentsField,
2003
+ allowPostDefaultComments: allowDefaultCommentsField,
1951
2004
  scheduledAt: scheduledAtField,
1952
2005
  ...labelFields2
1953
2006
  }),
@@ -2034,6 +2087,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
2034
2087
  reply_settings: z.enum(TWITTER_REPLY_SETTINGS).optional()
2035
2088
  }).optional().describe("X override."),
2036
2089
  comments: commentsField,
2090
+ allowPostDefaultComments: allowDefaultCommentsField,
2037
2091
  scheduledAt: scheduledAtField,
2038
2092
  ...labelFields2
2039
2093
  }),