add-external-link-to-story
Add external URLs to Shortcut stories to provide reference materials, documentation links, or related resources directly within project management workflows.
Instructions
Add an external link to a Shortcut story
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| storyPublicId | Yes | The public ID of the story | |
| externalLink | Yes | The external link URL to add |
Input Schema (JSON Schema)
{
"properties": {
"externalLink": {
"description": "The external link URL to add",
"format": "uri",
"maxLength": 2048,
"type": "string"
},
"storyPublicId": {
"description": "The public ID of the story",
"exclusiveMinimum": 0,
"type": "number"
}
},
"required": [
"storyPublicId",
"externalLink"
],
"type": "object"
}
Implementation Reference
- src/tools/stories.ts:625-634 (handler)Handler function for the 'add-external-link-to-story' tool. Performs input validation and delegates to the ShortcutClientWrapper to add the link, then returns a formatted result.async addExternalLinkToStory(storyPublicId: number, externalLink: string) { if (!storyPublicId) throw new Error("Story public ID is required"); if (!externalLink) throw new Error("External link is required"); const updatedStory = await this.client.addExternalLinkToStory(storyPublicId, externalLink); return this.toResult( `Added external link to story sc-${storyPublicId}. Story URL: ${updatedStory.app_url}`, ); }
- src/client/shortcut.ts:437-448 (handler)Core implementation logic for adding an external link to a story. Fetches the current story, checks for duplicate links (case-insensitive), appends the new link if unique, and updates the story via the Shortcut API.async addExternalLinkToStory(storyPublicId: number, externalLink: string): Promise<Story> { const story = await this.getStory(storyPublicId); if (!story) throw new Error(`Story ${storyPublicId} not found`); const currentLinks = story.external_links || []; if (currentLinks.some((link) => link.toLowerCase() === externalLink.toLowerCase())) { return story; } const updatedLinks = [...currentLinks, externalLink]; return await this.updateStory(storyPublicId, { external_links: updatedLinks }); }
- src/tools/stories.ts:278-287 (registration)MCP tool registration for 'add-external-link-to-story'. Specifies the tool name, description, input schema using Zod, and the handler function.server.tool( "add-external-link-to-story", "Add an external link to a Shortcut story", { storyPublicId: z.number().positive().describe("The public ID of the story"), externalLink: z.string().url().max(2048).describe("The external link URL to add"), }, async ({ storyPublicId, externalLink }) => await tools.addExternalLinkToStory(storyPublicId, externalLink), );
- src/tools/stories.ts:282-284 (schema)Input schema validation using Zod: storyPublicId as positive number, externalLink as valid URL up to 2048 chars.storyPublicId: z.number().positive().describe("The public ID of the story"), externalLink: z.string().url().max(2048).describe("The external link URL to add"), },