Skip to main content
Glama
spences10

mcp-n8n-builder

get_workflow

Retrieve detailed workflow information by ID, including nodes, connections, and settings, to analyze structure or prepare for updates in the n8n workflow system.

Instructions

Retrieves complete details of a specific workflow by its ID, including all nodes, connections, settings, and metadata. Use this tool when you need to examine a workflow's structure before updating it or to understand how it works.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the workflow to retrieve - can be obtained from list_workflows
verbosityNoOutput verbosity level (concise or full). Default is concise which preserves context window space. Use full when you need complete workflow details including all nodes and connections.

Implementation Reference

  • The primary handler function for the 'get_workflow' tool. Validates the workflow ID, fetches the full workflow data using the N8nApiClient, computes summary statistics (status, node counts, trigger nodes, tags), formats the output according to verbosity (concise summary or full JSON), and returns structured MCP content or error response.
    /**
     * Handles the get_workflow tool
     */
    export async function handle_get_workflow(
    	api_client: N8nApiClient,
    	args: any,
    ) {
    	if (!args.id) {
    		throw new McpError(
    			ErrorCode.InvalidParams,
    			'Workflow ID is required',
    		);
    	}
    
    	try {
    		const workflow = await api_client.get_workflow(args.id);
    
    		// Format a summary of the workflow
    		const activation_status = workflow.active ? 'Active' : 'Inactive';
    		const node_count = workflow.nodes.length;
    		const trigger_nodes = workflow.nodes.filter(
    			(node: { type: string }) =>
    				node.type.toLowerCase().includes('trigger'),
    		).length;
    
    		const summary = `Workflow: "${workflow.name}" (ID: ${args.id})
    Status: ${activation_status}
    Created: ${new Date(workflow.created_at).toLocaleString()}
    Updated: ${new Date(workflow.updated_at).toLocaleString()}
    Nodes: ${node_count} (including ${trigger_nodes} trigger nodes)
    Tags: ${
    			workflow.tags
    				?.map((tag: { name: string }) => tag.name)
    				.join(', ') || 'None'
    		}`;
    
    		return {
    			content: [
    				{
    					type: 'text',
    					text: format_output(summary, workflow, args.verbosity),
    				},
    			],
    		};
    	} catch (error: any) {
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Error retrieving workflow: ${
    						error.message || String(error)
    					}`,
    				},
    			],
    			isError: true,
    		};
    	}
    }
  • Tool registration in MCP listTools handler: defines 'get_workflow' with detailed description and inputSchema (required 'id': string, optional 'verbosity': 'concise'|'full').
    {
    	name: 'get_workflow',
    	description:
    		"Retrieves complete details of a specific workflow by its ID, including all nodes, connections, settings, and metadata. Use this tool when you need to examine a workflow's structure before updating it or to understand how it works.",
    	inputSchema: {
    		type: 'object',
    		properties: {
    			id: {
    				type: 'string',
    				description:
    					'ID of the workflow to retrieve - can be obtained from list_workflows',
    			},
    			verbosity: {
    				type: 'string',
    				description:
    					'Output verbosity level (concise or full). Default is concise which preserves context window space. Use full when you need complete workflow details including all nodes and connections.',
    				enum: ['concise', 'full'],
    			},
    		},
    		required: ['id'],
    	},
    },
  • Dispatch logic in MCP callTool handler: routes 'get_workflow' tool calls to the handle_get_workflow function with api_client and parsed arguments.
    case 'get_workflow':
    	return await handle_get_workflow(api_client, args);
  • Utility helper function used by get_workflow handler to conditionally include full JSON details or just summary based on verbosity parameter (overrides global config).
    /**
     * Helper function to format output based on verbosity setting
     * @param summary The human-readable summary text
     * @param details The full JSON details
     * @param verbosity The verbosity level (concise or full)
     * @returns Formatted text based on verbosity setting
     */
    function format_output(
    	summary: string,
    	details: any,
    	verbosity?: string,
    ): string {
    	// Use the provided verbosity parameter if available, otherwise fall back to config
    	const output_verbosity = verbosity || config.output_verbosity;
    
    	if (output_verbosity === 'full') {
    		return (
    			summary +
    			'\n\nFull details:\n' +
    			JSON.stringify(details, null, 2)
    		);
    	} else {
    		// Default to concise mode
    		return summary;
    	}
    }
  • N8nApiClient method invoked by the handler: performs authenticated GET request to n8n REST API endpoint /api/v1/workflows/{id} to retrieve raw workflow data.
     * Get a workflow by ID
     */
    async get_workflow(id: string): Promise<any> {
    	return this.request<any>('GET', `/workflows/${id}`);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool retrieves details (implying a read-only operation) and mentions output verbosity levels, which adds useful context. However, it lacks details on permissions, error handling, or response format, leaving behavioral gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence and follows with usage guidance in the second. Both sentences earn their place by adding clarity and context without redundancy, making it efficiently structured and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description does well by explaining the tool's purpose, usage, and implied parameters. It covers key aspects like what is retrieved and when to use it, but lacks details on return values or error cases, which could be more complete for a retrieval tool with no structured output information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (id and verbosity) thoroughly. The description adds minimal value beyond the schema by implying the id is used to retrieve workflow details, but it doesn't provide additional syntax or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('complete details of a specific workflow by its ID'), specifying what it returns ('including all nodes, connections, settings, and metadata'). It distinguishes from siblings like list_workflows (which lists workflows) and get_execution (which retrieves execution details), making the purpose specific and well-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('when you need to examine a workflow's structure before updating it or to understand how it works'), providing clear context. It implies alternatives by mentioning list_workflows for obtaining IDs and update_workflow for updates, giving practical guidance on usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/spences10/mcp-n8n-builder'

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