Skip to main content
Glama

get_control_flow

Build Control Flow Graphs (CFG) for functions to visualize logical paths through code, including branches, loops, and exception handling. Outputs diagrams in Mermaid, ASCII, or JSON formats.

Instructions

Build a Control Flow Graph (CFG) for a function/method: if/else branches, loops, try/catch, returns, throws. Shows logical paths through the code. Outputs Mermaid diagram, ASCII, or JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbol_idNoSymbol ID of the function/method
fqnNoFully qualified name of the function/method
formatNoOutput format (default: mermaid)
simplifyNoCollapse sequential statements (default: true)
Behavior3/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 describes what the tool does (builds CFGs showing logical paths) and output formats, but doesn't mention performance characteristics, error handling, authentication needs, rate limits, or whether it's a read-only operation. The description adds basic context but lacks operational details.

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 efficiently structured in two sentences: the first states the core purpose and scope, the second specifies output formats. Every word earns its place with zero redundancy or fluff, making it easy to parse quickly.

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

Completeness3/5

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

For a tool with 4 parameters, 100% schema coverage, but no annotations and no output schema, the description provides adequate basic purpose and output format information. However, it doesn't explain what the output looks like (structure of JSON, content of diagrams), error conditions, or performance expectations, leaving gaps for a tool that analyzes code structure.

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%, so the schema already fully documents all 4 parameters. The description mentions output formats (matching the 'format' parameter) but doesn't add meaning beyond what the schema provides for 'symbol_id', 'fqn', or 'simplify'. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('Build a Control Flow Graph') and resources ('for a function/method'), listing concrete code constructs it analyzes (if/else branches, loops, try/catch, returns, throws) and output formats (Mermaid diagram, ASCII, or JSON). It distinguishes from sibling tools like 'get_call_graph' or 'get_dataflow' by focusing specifically on control flow within functions.

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

Usage Guidelines3/5

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

The description implies usage context by specifying it builds CFGs for functions/methods, but doesn't explicitly state when to use this tool versus alternatives like 'get_call_graph' (which shows call relationships) or 'get_dataflow' (which tracks data dependencies). No explicit when-not-to-use guidance or prerequisites are provided.

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/nikolai-vysotskyi/trace-mcp'

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