Skip to main content
Glama

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
NameRequiredDescriptionDefault
clientIdYes

Implementation Reference

  • 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"] } },
  • Input schema for the 'list-workflows' tool, specifying it takes a clientId string.
    type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] }
  • 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'); }
  • Type definition for the response structure of listWorkflows, including data array and optional pagination cursor.
    interface N8nWorkflowList { data: N8nWorkflow[]; nextCursor?: string; }

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/illuminaresolutions/n8n-mcp-server'

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