Skip to main content
Glama

get-story-branch-name

Generate valid Git branch names from Shortcut story IDs to maintain consistent naming conventions in development workflows.

Instructions

Get a valid branch name for a specific story.

Input Schema

NameRequiredDescriptionDefault
storyPublicIdYesThe public Id of the story

Input Schema (JSON Schema)

{ "properties": { "storyPublicId": { "description": "The public Id of the story", "exclusiveMinimum": 0, "type": "number" } }, "required": [ "storyPublicId" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'get-story-branch-name' tool. It fetches the current user and the story by public ID, then returns the story's formatted VCS branch name if available, or generates one using the createBranchName helper.
    async getStoryBranchName(storyPublicId: number) { const currentUser = await this.client.getCurrentUser(); if (!currentUser) throw new Error("Unable to find current user"); const story = await this.client.getStory(storyPublicId); if (!story) throw new Error(`Failed to retrieve Shortcut story with public ID: ${storyPublicId}`); const branchName = (story as Story & { formatted_vcs_branch_name: string | null }).formatted_vcs_branch_name || this.createBranchName(currentUser, story); return this.toResult(`Branch name for story sc-${storyPublicId}: ${branchName}`); }
  • MCP server tool registration for 'get-story-branch-name', specifying the description, input schema, and linking to the getStoryBranchName handler method.
    server.tool( "get-story-branch-name", "Get a valid branch name for a specific story.", { storyPublicId: z.number().positive().describe("The public Id of the story"), }, async ({ storyPublicId }) => await tools.getStoryBranchName(storyPublicId), );
  • Helper function to generate a branch name in the format '{user-mention}/sc-{story-id}/{slugified-story-name}', truncated to 50 characters.
    private createBranchName(currentUser: MemberInfo, story: Story) { return `${currentUser.mention_name}/sc-${story.id}/${story.name .toLowerCase() .replace(/\s+/g, "-") .replace(/[^\w-]/g, "")}`.substring(0, 50); }

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/ampcome-mcps/shortcut-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server