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
      );
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Read' which implies a read-only operation, but doesn't address permissions, error handling, or what happens if the file doesn't exist. This is inadequate for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it immediately understandable and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with no annotations and no output schema, the description is insufficient. It doesn't explain what the return value contains (e.g., workflow JSON structure), error conditions, or how 'specific' differs from other retrieval tools, leaving significant gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'path' fully documented in the schema. The description adds no additional parameter semantics beyond implying it's for workflow files, so it meets the baseline for high schema coverage without adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Read') and resource ('a specific n8n workflow JSON file'), making the purpose immediately understandable. However, it doesn't differentiate from siblings like 'list' or 'info' that might also retrieve workflow information, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list' or 'info' from the sibling tools. It mentions 'specific' but doesn't clarify prerequisites or exclusions, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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