add-task-to-story
Add tasks to Shortcut stories with descriptions and assign owners to organize project work and track responsibilities.
Instructions
Add a task to a story
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| storyPublicId | Yes | The public ID of the story | |
| taskDescription | Yes | The description of the task | |
| taskOwnerIds | No | Array of user IDs to assign as owners of the task |
Input Schema (JSON Schema)
{
"properties": {
"storyPublicId": {
"description": "The public ID of the story",
"exclusiveMinimum": 0,
"type": "number"
},
"taskDescription": {
"description": "The description of the task",
"minLength": 1,
"type": "string"
},
"taskOwnerIds": {
"description": "Array of user IDs to assign as owners of the task",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"storyPublicId",
"taskDescription"
],
"type": "object"
}
Implementation Reference
- src/tools/stories.ts:519-546 (handler)The main handler function that implements the logic to add a task to a Shortcut story by calling the client.addTaskToStory method after validation.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}.`); }
- src/tools/stories.ts:236-243 (schema)Zod input schema defining parameters for the 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"), },
- src/tools/stories.ts:233-245 (registration)MCP server tool registration for 'add-task-to-story', linking the schema and handler.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), );