get-stories-by-external-link
Find all Shortcut stories that contain a specific external URL to track linked content across your project management system.
Instructions
Find all stories that contain a specific external link
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| externalLink | Yes | The external link URL to search for |
Input Schema (JSON Schema)
{
"properties": {
"externalLink": {
"description": "The external link URL to search for",
"format": "uri",
"maxLength": 2048,
"type": "string"
}
},
"required": [
"externalLink"
],
"type": "object"
}
Implementation Reference
- src/tools/stories.ts:647-660 (handler)The handler function that executes the tool's core logic: validates input, fetches stories via the Shortcut client, handles empty results, and formats the output using toResult and entitiesWithRelatedEntities.async getStoriesByExternalLink(externalLink: string) { if (!externalLink) throw new Error("External link is required"); const { stories, total } = await this.client.getStoriesByExternalLink(externalLink); if (!stories || !stories.length) { return this.toResult(`No stories found with external link: ${externalLink}`); } return this.toResult( `Found ${total} stories with external link: ${externalLink}`, await this.entitiesWithRelatedEntities(stories, "stories"), ); }
- src/tools/stories.ts:300-307 (registration)Registers the MCP tool 'get-stories-by-external-link' with the server, providing the name, description, input schema, and reference to the handler method.server.tool( "get-stories-by-external-link", "Find all stories that contain a specific external link", { externalLink: z.string().url().max(2048).describe("The external link URL to search for"), }, async ({ externalLink }) => await tools.getStoriesByExternalLink(externalLink), );
- src/tools/stories.ts:303-305 (schema)Zod input schema defining 'externalLink' as a URL string with max length 2048 characters.{ externalLink: z.string().url().max(2048).describe("The external link URL to search for"), },
- src/client/shortcut.ts:462-471 (helper)Supporting utility in ShortcutClientWrapper that calls the base Shortcut API's getExternalLinkStories method with lowercased external_link, handling response and returning stories with total count.async getStoriesByExternalLink(externalLink: string) { const response = await this.client.getExternalLinkStories({ external_link: externalLink.toLowerCase(), }); const stories = response?.data; if (!stories) return { stories: null, total: null }; return { stories, total: stories.length }; }