Skip to main content
Glama

read

Access and retrieve n8n workflow JSON files to analyze automation processes, extract code components, and facilitate workflow management and deployment.

Instructions

Read a specific n8n workflow JSON file

Input Schema

NameRequiredDescriptionDefault
pathYesPath to the workflow file relative to workflows root

Input Schema (JSON Schema)

{ "properties": { "path": { "description": "Path to the workflow file relative to workflows root", "type": "string" } }, "required": [ "path" ], "type": "object" }

Implementation Reference

  • Core handler function that executes the 'read' tool logic: reads the workflow file, parses JSON, optionally formats it, and returns as MCP content
    async readWorkflow(workflowPath: string, options?: { format?: boolean; raw?: boolean }): Promise<any> { try { const fullPath = path.join(this.workflowsPath, workflowPath); const content = await fs.readFile(fullPath, 'utf-8'); const workflow = JSON.parse(content); // Return raw JSON if requested if (options?.raw) { return { content: [ { type: 'text', text: content, }, ], }; } // Format the workflow for better readability const formatted = this.formatter.formatWorkflow(workflow, { colorize: true, indent: 2, compact: false, showNodeDetails: true }); return { content: [ { type: 'text', text: formatted, }, ], }; } catch (error) { throw new Error(`Failed to read workflow: ${error}`); } }
  • Entry point handler in ToolHandler.handleTool switch statement that dispatches 'read' tool calls to WorkflowManager.readWorkflow
    case 'read': return await this.workflowManager.readWorkflow(args?.path as string);
  • Schema definition specifying input requirements (path parameter) and description for the 'read' tool
    name: 'read', description: 'Read a specific n8n workflow JSON file', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the workflow file relative to workflows root', }, }, required: ['path'], }, },
  • MCP server registration of all tools (including 'read') via getToolDefinitions() from registry.ts
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions(), }));

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/mckinleymedia/mcflow-mcp'

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