n8n_get_workflow
Retrieve detailed information about a specific workflow including all nodes and connections by providing the workflow ID.
Instructions
Get detailed information about a specific workflow including all nodes and connections.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The workflow ID |
Implementation Reference
- src/tools/workflow-tools.ts:198-227 (handler)The main execution handler for the 'n8n_get_workflow' tool. It validates the workflow ID, fetches the full workflow data using N8nApiClient.getWorkflow(), and returns a formatted JSON response containing workflow details, nodes, connections, settings, and tags.n8n_get_workflow: async ( client: N8nApiClient, args: Record<string, unknown> ): Promise<ToolResult> => { const id = args.id as string; if (!id) { throw new Error('Workflow ID is required'); } const workflow = await client.getWorkflow(id); return { content: [ { type: 'text' as const, text: JSON.stringify({ id: workflow.id, name: workflow.name, active: workflow.active, createdAt: workflow.createdAt, updatedAt: workflow.updatedAt, nodes: workflow.nodes, connections: workflow.connections, settings: workflow.settings, tags: workflow.tags, }, null, 2), }, ], }; },
- src/tools/workflow-tools.ts:31-44 (schema)Tool schema definition specifying the name, description, and input schema (requiring 'id' string parameter) for input validation.{ name: 'n8n_get_workflow', description: 'Get detailed information about a specific workflow including all nodes and connections.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The workflow ID', }, }, required: ['id'], }, },
- src/tools/index.ts:12-16 (registration)Central registration of all tools by spreading workflowTools into the allTools array, which provides the complete tool list to the MCP server.export const allTools: ToolDefinition[] = [ ...documentationTools, // Documentation first for discoverability ...workflowTools, ...executionTools, ];
- src/server.ts:60-63 (registration)MCP server handler for listing tools, returning the aggregated allTools list which includes the n8n_get_workflow schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, };
- src/server.ts:122-125 (registration)Dynamic dispatch to workflowToolHandlers based on tool name, routing 'n8n_get_workflow' calls to its specific handler function.if (name in workflowToolHandlers) { const handler = workflowToolHandlers[name as keyof typeof workflowToolHandlers]; return handler(client, args); }