Skip to main content
Glama

analyze

Analyze workflow structure and dependencies to identify connections and optimize automation processes for efficient development.

Instructions

Analyze a workflow structure and dependencies

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

  • The switch case in ToolHandler.handleTool that executes the 'analyze' tool by calling analyzeWorkflow with the workflows path and the provided path argument.
    case 'analyze': return await analyzeWorkflow(this.workflowsPath, args?.path as string);
  • Tool definition including name, description, and input schema for the 'analyze' tool, which requires a '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'], }, },
  • Core implementation function that reads the workflow JSON file, parses it, analyzes structure (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}`); } }

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