get_workflow
Retrieve a specific n8n workflow by its unique ID to access, analyze, or manage automation processes within the n8n platform.
Instructions
Get a specific n8n workflow by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The workflow ID |
Implementation Reference
- src/index.ts:393-398 (handler)MCP tool handler for 'get_workflow'. Resolves workflow ID alias if needed, fetches the workflow using N8nClient, attaches numeric alias, and returns the workflow as JSON success response.private async handleGetWorkflow(args: { id: string | number }) { const id = this.resolveWorkflowId(args.id); const workflow = await this.n8nClient.getWorkflow(id); this.withAlias(workflow); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(workflow), null, 2) }] }; }
- src/index.ts:70-70 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'get_workflow', description: 'Get a specific n8n workflow by ID', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'The workflow ID' } }, required: ['id'] } },
- src/index.ts:70-70 (schema)Input schema definition for the get_workflow tool, specifying the required 'id' parameter as string or number.{ name: 'get_workflow', description: 'Get a specific n8n workflow by ID', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'The workflow ID' } }, required: ['id'] } },
- src/n8n-client.ts:160-164 (helper)N8nClient helper method that makes the actual API call to retrieve a workflow by ID from the n8n server.async getWorkflow(id: string | number): Promise<N8nWorkflow> { const response = await this.api.get<N8nApiResponse<N8nWorkflow> | N8nWorkflow>(`/workflows/${id}`); const payload: any = response.data as any; return (payload && typeof payload === 'object' && 'data' in payload) ? payload.data : payload; }