list-workflows
Retrieve all available workflows from the n8n platform. This tool requires a valid clientId and is used to display workflow details after initialization, supporting seamless integration with LLMs via the MCP server.
Instructions
List all workflows from n8n. Use after init-n8n to see available workflows. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes |
Implementation Reference
- src/index.ts:887-926 (handler)Handler for the 'list-workflows' tool. Retrieves the N8nClient by clientId, calls its listWorkflows method, formats the workflow data, and returns it as JSON text content.case "list-workflows": { const { clientId } = args as { clientId: 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 workflows = await client.listWorkflows(); const formattedWorkflows = workflows.data.map(wf => ({ id: wf.id, name: wf.name, active: wf.active, created: wf.createdAt, updated: wf.updatedAt, tags: wf.tags, })); return { content: [{ type: "text", text: JSON.stringify(formattedWorkflows, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:412-422 (registration)Registration of the 'list-workflows' tool in the ListToolsRequestSchema handler's tools array, defining name, description, and input schema requiring clientId.{ name: "list-workflows", description: "List all workflows from n8n. Use after init-n8n to see available workflows. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } },
- src/index.ts:416-421 (schema)Input schema for the 'list-workflows' tool, specifying it takes a clientId string.type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] }
- src/index.ts:156-158 (helper)N8nClient helper method listWorkflows() that calls the n8n API endpoint '/workflows' to fetch the list of workflows.async listWorkflows(): Promise<N8nWorkflowList> { return this.makeRequest<N8nWorkflowList>('/workflows'); }
- src/index.ts:33-36 (helper)Type definition for the response structure of listWorkflows, including data array and optional pagination cursor.interface N8nWorkflowList { data: N8nWorkflow[]; nextCursor?: string; }