Skip to main content
Glama
useshortcut

Shortcut MCP Server

Official
by useshortcut

workflows-get-default

Retrieve the default workflow for a specified team or the global default workflow when no team is provided.

Instructions

Get the default workflow for a specific team or the global default if no team is specified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamPublicIdNoThe public ID of the team to get the default workflow for.

Implementation Reference

  • The main handler function that retrieves the default workflow for a team or the global default, using the ShortcutClientWrapper.
    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.");
    }
  • Registers the 'workflows-get-default' tool with the MCP server, including schema and handler reference.
    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),
    );
  • Zod schema for the tool input parameters.
    {
    	teamPublicId: z
    		.string()
    		.optional()
    		.describe("The public ID of the team to get the default workflow for."),
    },

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