get-workflow
Retrieve detailed information about a specific workflow using its ID after listing workflows. Requires client ID and workflow ID as compact JSON input.
Instructions
Retrieve a workflow by ID. Use after list-workflows to get detailed information about a specific workflow. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes |
Implementation Reference
- src/index.ts:928-958 (handler)MCP tool handler for 'get-workflow': validates clientId, retrieves N8nClient instance, calls client.getWorkflow(id), and returns the workflow JSON or error.case "get-workflow": { const { clientId, id } = args as { clientId: string; id: string }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const workflow = await client.getWorkflow(id); return { content: [{ type: "text", text: JSON.stringify(workflow, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:424-434 (registration)Tool registration in ListTools response, defining name, description, and input schema for 'get-workflow'.name: "get-workflow", description: "Retrieve a workflow by ID. Use after list-workflows to get detailed information about a specific workflow. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } },
- src/index.ts:160-162 (helper)N8nClient helper method that performs the actual API call to fetch workflow by ID via makeRequest.async getWorkflow(id: string): Promise<N8nWorkflow> { return this.makeRequest<N8nWorkflow>(`/workflows/${id}`); }
- src/index.ts:24-31 (schema)TypeScript interface defining the structure of an N8n workflow object returned by the API.interface N8nWorkflow { id: number; name: string; active: boolean; createdAt: string; updatedAt: string; tags: string[]; }