Skip to main content
Glama
useshortcut

Shortcut MCP Server

Official
by useshortcut

stories-get-by-external-link

Retrieve Shortcut stories containing a specific external URL to track references and dependencies across project management tasks.

Instructions

Find all stories that contain a specific external link

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
externalLinkYesThe external link URL to search for

Implementation Reference

  • The main handler function for the 'stories-get-by-external-link' tool. It validates input, calls the client wrapper to fetch stories, and formats the result.
    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"),
    	);
    }
  • Registers the 'stories-get-by-external-link' tool on the MCP server, defining its name, description, input schema, and handler.
    server.addToolWithReadAccess(
    	"stories-get-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),
    );
  • Zod input schema for the tool, validating the externalLink parameter as a URL string up to 2048 characters.
    {
    	externalLink: z.string().url().max(2048).describe("The external link URL to search for"),
    },
  • Helper method in ShortcutClientWrapper that queries the Shortcut API for stories linked to the given external link, lowercasing the link for matching.
    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 };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/useshortcut/mcp-server-shortcut'

If you have feedback or need assistance with the MCP directory API, please join our Discord server