Skip to main content
Glama

read

Retrieve and parse n8n workflow JSON files to access automation configurations and structure for development and deployment.

Instructions

Read a specific n8n workflow JSON file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the workflow file relative to workflows root

Implementation Reference

  • Defines the schema, name, and description for the MCP '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'], }, },
  • ToolHandler.handleTool switch case that dispatches 'read' tool calls to WorkflowManager.readWorkflow.
    case 'read': return await this.workflowManager.readWorkflow(args?.path as string);
  • Core implementation of reading the workflow file: constructs full path, reads and parses JSON, formats output for MCP response.
    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}`); } }
  • Registers the list of available tools (including 'read') via ListToolsRequestSchema using getToolDefinitions() from registry.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions(), }));
  • Registers the generic tool execution handler via CallToolRequestSchema, which routes to ToolHandler.handleTool for 'read' execution.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { return await this.toolHandler.handleTool( request.params.name, request.params.arguments ); });

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