stories-assign-current-user
Assign yourself as the owner of a Shortcut story to manage project tasks directly from AI tools.
Instructions
Assign the current user as the owner of a story
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| storyPublicId | Yes | The public ID of the story |
Implementation Reference
- src/tools/stories.ts:378-396 (handler)Implements the logic to assign the current user as an owner to the specified story. Fetches the story and current user, checks if already assigned, and updates the story's owner_ids if not.async assignCurrentUserAsOwner(storyPublicId: number) { const story = await this.client.getStory(storyPublicId); if (!story) throw new Error(`Failed to retrieve Shortcut story with public ID: ${storyPublicId}`); const currentUser = await this.client.getCurrentUser(); if (!currentUser) throw new Error("Failed to retrieve current user"); if (story.owner_ids.includes(currentUser.id)) return this.toResult(`Current user is already an owner of story sc-${storyPublicId}`); await this.client.updateStory(storyPublicId, { owner_ids: story.owner_ids.concat([currentUser.id]), }); return this.toResult(`Assigned current user as owner of story sc-${storyPublicId}`); }
- src/tools/stories.ts:228-235 (registration)Registers the tool 'stories-assign-current-user' with its schema (storyPublicId: number) and links to the handler assignCurrentUserAsOwner.server.addToolWithWriteAccess( "stories-assign-current-user", "Assign the current user as the owner of a story", { storyPublicId: z.number().positive().describe("The public ID of the story"), }, async ({ storyPublicId }) => await tools.assignCurrentUserAsOwner(storyPublicId), );
- src/tools/stories.ts:232-233 (schema)Zod schema defining the input parameter: storyPublicId as a positive number.storyPublicId: z.number().positive().describe("The public ID of the story"), },