Skip to main content
Glama
useshortcut

Shortcut MCP Server

Official
by useshortcut

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
NameRequiredDescriptionDefault
parentStoryPublicIdYesThe public ID of the parent story
subTaskPublicIdYesThe public ID of the sub-task story

Implementation Reference

  • 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}`,
    	);
    }
  • 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),
    );
  • 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"),
    },

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