Skip to main content
Glama

add-task-to-story

Add tasks to Shortcut stories to track work items and assign responsibilities within project management workflows.

Instructions

Add a task to a story

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
storyPublicIdYesThe public ID of the story
taskDescriptionYesThe description of the task
taskOwnerIdsNoArray of user IDs to assign as owners of the task

Implementation Reference

  • The main handler function for the 'add-task-to-story' tool. It validates inputs, fetches the story to ensure it exists, optionally resolves task owners, and calls the Shortcut client to add the task to the story.
    async addTaskToStory({ storyPublicId, taskDescription, taskOwnerIds, }: { storyPublicId: number; taskDescription: string; taskOwnerIds?: string[]; }) { if (!storyPublicId) throw new Error("Story public ID is required"); if (!taskDescription) throw new Error("Task description is required"); const story = await this.client.getStory(storyPublicId); if (!story) throw new Error(`Failed to retrieve Shortcut story with public ID: ${storyPublicId}`); if (taskOwnerIds?.length) { const owners = await this.client.getUserMap(taskOwnerIds as string[]); if (!owners) throw new Error(`Failed to retrieve users with IDs: ${taskOwnerIds.join(", ")}`); } const task = await this.client.addTaskToStory(storyPublicId, { description: taskDescription, ownerIds: taskOwnerIds, }); return this.toResult(`Created task for story sc-${storyPublicId}. Task ID: ${task.id}.`); }
  • Registers the 'add-task-to-story' tool with the MCP server, including the input schema using Zod and linking to the handler method.
    server.tool( "add-task-to-story", "Add a task to a story", { storyPublicId: z.number().positive().describe("The public ID of the story"), taskDescription: z.string().min(1).describe("The description of the task"), taskOwnerIds: z .array(z.string()) .optional() .describe("Array of user IDs to assign as owners of the task"), }, async (params) => await tools.addTaskToStory(params), );
  • Zod schema defining the input parameters for the 'add-task-to-story' tool: storyPublicId (required number), taskDescription (required string), taskOwnerIds (optional array of strings).
    storyPublicId: z.number().positive().describe("The public ID of the story"), taskDescription: z.string().min(1).describe("The description of the task"), taskOwnerIds: z .array(z.string()) .optional() .describe("Array of user IDs to assign as owners of the task"), },
  • Core call to the ShortcutClientWrapper's addTaskToStory method, which performs the actual API interaction to add the task.
    const task = await this.client.addTaskToStory(storyPublicId, { description: taskDescription, ownerIds: taskOwnerIds, }); return this.toResult(`Created task for story sc-${storyPublicId}. Task ID: ${task.id}.`); }

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/ampcome-mcps/shortcut-mcp'

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