Skip to main content
Glama

analyze

Analyze workflow structure and dependencies to identify connections and optimize automation processes in McFlow.

Instructions

Analyze a workflow structure and dependencies

Input Schema

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

Implementation Reference

  • The core handler function that implements the 'analyze' tool logic: reads the workflow JSON, extracts key metrics (node count, list of nodes, connections, triggers, error handling), and returns formatted analysis.
    export async function analyzeWorkflow(workflowsPath: string, workflowPath: string): Promise<any> {
      try {
        const fullPath = path.join(workflowsPath, workflowPath);
        const content = await fs.readFile(fullPath, 'utf-8');
        const workflow = JSON.parse(content);
    
        const analysis = {
          name: workflow.name,
          nodeCount: workflow.nodes?.length || 0,
          nodes: workflow.nodes?.map((node: any) => ({
            id: node.id,
            name: node.name,
            type: node.type,
            position: node.position,
          })) || [],
          connections: workflow.connections || {},
          triggers: workflow.nodes?.filter((node: any) =>
            node.type.includes('trigger') || node.type.includes('Trigger')
          ).map((node: any) => node.name) || [],
          hasErrorHandling: workflow.nodes?.some((node: any) =>
            node.type.includes('error') || node.name.toLowerCase().includes('error')
          ) || false,
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(analysis, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to analyze workflow: ${error}`);
      }
    }
  • Registers the 'analyze' tool in the MCP tool definitions array, including name, description, and input schema requiring the 'path' parameter.
    {
      name: 'analyze',
      description: 'Analyze a workflow structure and dependencies',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the workflow file relative to workflows root',
          },
        },
        required: ['path'],
      },
    },
  • Dispatches the 'analyze' tool call to the analyzeWorkflow implementation in the main ToolHandler.handleTool switch statement.
    case 'analyze':
      return await analyzeWorkflow(this.workflowsPath, args?.path as string);
  • Defines the input schema for the 'analyze' tool: object with required 'path' string property.
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Path to the workflow file relative to workflows root',
        },
      },
      required: ['path'],
    },
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 the tool analyzes structure and dependencies but doesn't describe what the analysis entails, whether it's read-only or has side effects, what format results are in, or any performance or permission considerations. This leaves significant gaps for a tool that presumably returns insights.

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, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple tool with one parameter.

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?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what the analysis returns, how results are structured, or any behavioral traits. For a tool that likely produces complex output about workflows, this leaves the agent guessing about the tool's full functionality.

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?

Schema description coverage is 100%, with the single parameter 'path' fully documented in the schema. The description doesn't add any meaning beyond the schema—it doesn't clarify what constitutes a valid workflow file or path format. Baseline 3 is appropriate since the schema does the heavy lifting.

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 action ('analyze') and the target ('workflow structure and dependencies'), which provides a specific verb+resource combination. However, it doesn't distinguish this tool from siblings like 'validate' or 'info' that might also examine workflows, missing full sibling differentiation.

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 'validate' or 'info'. It lacks any context about prerequisites, expected outcomes, or scenarios where this analysis is appropriate versus other inspection tools.

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