get-default-workflow
Retrieve the default workflow for a specific team or the global default when no team is specified, streamlining project setup and management within the Shortcut MCP Server environment.
Instructions
Get the default workflow for a specific team or the global default if no team is specified.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| teamPublicId | No | The public ID of the team to get the default workflow for. |
Implementation Reference
- src/tools/workflows.ts:47-80 (handler)The core handler function implementing the logic to retrieve the default Shortcut workflow for a specific team or the global workspace default. It fetches team-specific default if provided, falls back to workspace default, formats results using inherited methods.async getDefaultWorkflow(teamPublicId?: string) { if (teamPublicId) { try { const teamDefaultWorkflowId = await this.client .getTeam(teamPublicId) .then((t) => t?.default_workflow_id); if (teamDefaultWorkflowId) { const teamDefaultWorkflow = await this.client.getWorkflow(teamDefaultWorkflowId); if (teamDefaultWorkflow) { return this.toResult( `Default workflow for team "${teamPublicId}" has id ${teamDefaultWorkflow.id}.`, await this.entityWithRelatedEntities(teamDefaultWorkflow, "workflow"), ); } } } catch {} } const currentUser = await this.client.getCurrentUser(); if (!currentUser) throw new Error("Failed to retrieve current user."); const workspaceDefaultWorkflowId = currentUser.workspace2.default_workflow_id; const workspaceDefaultWorkflow = await this.client.getWorkflow(workspaceDefaultWorkflowId); if (workspaceDefaultWorkflow) { return this.toResult( `${teamPublicId ? `No default workflow found for team with public ID "${teamPublicId}". The general default workflow has id ` : "Default workflow has id "}${workspaceDefaultWorkflow.id}.`, await this.entityWithRelatedEntities(workspaceDefaultWorkflow, "workflow"), ); } return this.toResult("No default workflow found."); }
- src/tools/workflows.ts:10-20 (registration)Registers the MCP tool named 'workflows-get-default' (matches intent of 'get-default-workflow') with input schema and delegates to the getDefaultWorkflow handler.server.addToolWithReadAccess( "workflows-get-default", "Get the default workflow for a specific team or the global default if no team is specified.", { teamPublicId: z .string() .optional() .describe("The public ID of the team to get the default workflow for."), }, async ({ teamPublicId }) => await tools.getDefaultWorkflow(teamPublicId), );
- src/tools/workflows.ts:13-18 (schema)Zod input schema for the tool: optional teamPublicId string.{ teamPublicId: z .string() .optional() .describe("The public ID of the team to get the default workflow for."), },