remove-external-link-from-story
Remove external URLs from Shortcut stories to clean up project documentation and maintain focused content.
Instructions
Remove an external link from a Shortcut story
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| storyPublicId | Yes | The public ID of the story | |
| externalLink | Yes | The external link URL to remove |
Input Schema (JSON Schema)
{
"properties": {
"externalLink": {
"description": "The external link URL to remove",
"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:289-298 (registration)Registration of the 'remove-external-link-from-story' MCP tool, including name, description, Zod input schema, and reference to the handler method.server.tool( "remove-external-link-from-story", "Remove an external link from 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 remove"), }, async ({ storyPublicId, externalLink }) => await tools.removeExternalLinkFromStory(storyPublicId, externalLink), );
- src/tools/stories.ts:636-645 (handler)MCP tool handler: validates inputs, delegates to client wrapper for removal, and returns formatted success message with story URL.async removeExternalLinkFromStory(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.removeExternalLinkFromStory(storyPublicId, externalLink); return this.toResult( `Removed external link from story sc-${storyPublicId}. Story URL: ${updatedStory.app_url}`, ); }
- src/tools/stories.ts:292-295 (schema)Zod input schema defining storyPublicId (positive number) and externalLink (URL string max 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 remove"), },
- src/client/shortcut.ts:450-460 (helper)Core utility in client wrapper: fetches story, filters out the matching external link case-insensitively from external_links array, then updates the story via API.async removeExternalLinkFromStory(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 || []; const updatedLinks = currentLinks.filter( (link) => link.toLowerCase() !== externalLink.toLowerCase(), ); return await this.updateStory(storyPublicId, { external_links: updatedLinks }); }