stories-add-subtask
Link an existing story as a sub-task to a parent story in Shortcut project management, organizing work into hierarchical relationships.
Instructions
Add an existing story as a sub-task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parentStoryPublicId | Yes | The public ID of the parent story | |
| subTaskPublicId | Yes | The public ID of the sub-task story |
Implementation Reference
- src/tools/stories.ts:520-543 (handler)Handler function that implements the logic for adding an existing story as a subtask to a parent story by fetching both stories and updating the subtask's parent_story_id via the client.async addStoryAsSubTask({ parentStoryPublicId, subTaskPublicId, }: { parentStoryPublicId: number; subTaskPublicId: number; }) { if (!parentStoryPublicId) throw new Error("ID of parent story is required"); if (!subTaskPublicId) throw new Error("ID of sub-task story is required"); const subTask = await this.client.getStory(subTaskPublicId); if (!subTask) throw new Error(`Failed to retrieve story with public ID: ${subTaskPublicId}`); const parentStory = await this.client.getStory(parentStoryPublicId); if (!parentStory) throw new Error(`Failed to retrieve parent story with public ID: ${parentStoryPublicId}`); await this.client.updateStory(subTaskPublicId, { parent_story_id: parentStoryPublicId, }); return this.toResult( `Added story sc-${subTaskPublicId} as a sub-task of sc-${parentStoryPublicId}`, ); }
- src/tools/stories.ts:267-275 (registration)Tool registration call that registers 'stories-add-subtask' with input schema using Zod and links to the addStoryAsSubTask handler.server.addToolWithWriteAccess( "stories-add-subtask", "Add an existing story as a sub-task", { parentStoryPublicId: z.number().positive().describe("The public ID of the parent story"), subTaskPublicId: z.number().positive().describe("The public ID of the sub-task story"), }, async (params) => await tools.addStoryAsSubTask(params), );
- src/tools/stories.ts:270-273 (schema)Zod input schema defining parameters for the 'stories-add-subtask' tool: parentStoryPublicId and subTaskPublicId.{ parentStoryPublicId: z.number().positive().describe("The public ID of the parent story"), subTaskPublicId: z.number().positive().describe("The public ID of the sub-task story"), },