set-story-external-links
Update all external links in a Shortcut story by replacing them with a specified array of URLs. Use this tool to manage and modify story-related external resources efficiently.
Instructions
Replace all external links on a story with a new set of links
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| externalLinks | Yes | Array of external link URLs to set (replaces all existing links) | |
| storyPublicId | Yes | The public ID of the story |
Implementation Reference
- src/tools/stories.ts:324-335 (registration)Registration of the 'stories-set-external-links' tool using server.addToolWithWriteAccess, including input schema and handler reference."stories-set-external-links", "Replace all external links on a story with a new set of links", { storyPublicId: z.number().positive().describe("The public ID of the story"), externalLinks: z .array(z.string().url().max(2048)) .describe("Array of external link URLs to set (replaces all existing links)"), }, async ({ storyPublicId, externalLinks }) => await tools.setStoryExternalLinks(storyPublicId, externalLinks), );
- src/tools/stories.ts:703-716 (handler)The main handler function 'setStoryExternalLinks' that executes the tool logic by calling the Shortcut client to set the external links on the story and returns a formatted result.async setStoryExternalLinks(storyPublicId: number, externalLinks: string[]) { if (!storyPublicId) throw new Error("Story public ID is required"); if (!Array.isArray(externalLinks)) throw new Error("External links must be an array"); const updatedStory = await this.client.setStoryExternalLinks(storyPublicId, externalLinks); const linkCount = externalLinks.length; const message = linkCount === 0 ? `Removed all external links from story sc-${storyPublicId}` : `Set ${linkCount} external link${linkCount === 1 ? "" : "s"} on story sc-${storyPublicId}`; return this.toResult(`${message}. Story URL: ${updatedStory.app_url}`); }
- src/tools/stories.ts:326-331 (schema)Input schema using Zod for validating the tool parameters: storyPublicId (number) and externalLinks (array of URLs). Note: Tool name is 'stories-set-external-links', closely matching query.{ storyPublicId: z.number().positive().describe("The public ID of the story"), externalLinks: z .array(z.string().url().max(2048)) .describe("Array of external link URLs to set (replaces all existing links)"), },