Skip to main content
Glama

add-task-to-story

Assign tasks to a Shortcut story with a description and designated owners using the MCP server. Simplify project management by integrating with AI tools for streamlined task creation.

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

  • Handler function that implements the logic for adding a task to a story: validates inputs, fetches the story, checks owners, calls client.addTaskToStory, and returns formatted result.
    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}.`); }
  • MCP tool registration for 'stories-add-task', including input schema using Zod and handler that delegates to tools.addTaskToStory
    server.addToolWithWriteAccess( "stories-add-task", "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 input schema for the 'stories-add-task' tool defining parameters: storyPublicId, taskDescription, and optional taskOwnerIds.
    { 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"), },
  • Helper method in ShortcutClientWrapper that wraps the base Shortcut API's createTask method to add a task to a story.
    async addTaskToStory( storyPublicId: number, taskParams: { description: string; ownerIds?: string[]; }, ): Promise<Task> { const { description, ownerIds } = taskParams; const params = { description, owner_ids: ownerIds, }; const response = await this.client.createTask(storyPublicId, params); const task = response?.data ?? null; if (!task) throw new Error(`Failed to create the task: ${response.status}`); return task; }

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