Skip to main content
Glama

trace_data_flow

Trace how a C/C++ data type flows through call paths to a target function, using libclang to map cross-file data flow.

Instructions

Trace how C/C++ data of a given type flows to a target function via libclang call paths. libclang-powered: finds functions by type signature and maps call paths through the full call graph, which text-based search cannot trace across translation units.

Finds functions whose signature mentions type_name, then looks for call paths from those functions to to_symbol. Returns a data flow map — useful for understanding how a data structure travels through the system to its destination.

Works best for synchronous driver stacks (e.g. sensor read → I2C write). Cannot follow async flows (message queues, interrupts, RS485 callbacks). For exact call-graph queries use the find_* family; verify specific paths with find_call_path.

Read-only. No side effects. Requires the reference index (fw-context index — refs on by default).

Args: type_name: Type name to trace. E.g. 'SensorData' or 'Config::SensorData'. to_symbol: Target symbol name. E.g. 'uart_send' or 'UART_DRIVER::send'. project_root: Project root. Auto-detected if omitted. max_depth: Maximum call path depth (default 8). limit: Maximum source functions to trace (default 15). timeout_ms: Maximum total execution time in milliseconds (default 30000). Clamped to 1000–300000.

Returns: list of dicts with a leading _summary entry: {_summary (str), _type (str), _target (str)}, followed by source entries each with: source_name, source_qualified_name, source_kind, source_file, source_line, caller_count, reachable (bool), and paths (list of call path dicts — empty when unreachable).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum source functions to trace (default 15).
max_depthNoMaximum call path depth (default 8).
to_symbolYesTarget symbol name. E.g. 'uart_send' or 'UART_DRIVER::send'.
type_nameYesType name to trace. E.g. 'SensorData' or 'Config::SensorData'.
timeout_msNoMaximum total execution time in milliseconds (default 30000).
project_rootNoProject root. Auto-detected if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden. It explicitly states 'Read-only. No side effects.' and mentions the required reference index. It also discloses limitations (async flows) and constraint details like the timeout clamping, giving a complete safety and boundary picture.

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?

Although lengthy, the description is well-structured with clear paragraphs and a dedicated Args/Returns section. Every sentence adds functional detail—purpose, mechanism, use cases, limitations, parameters, and output shape—without redundant filler. The core purpose is front-loaded in the first sentence.

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

Completeness5/5

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

The description covers all necessary elements for a complex tool: full parameter explanations, return format description (including the _summary entry and per-source fields), usage context, and limitations. With 6 parameters and a return structure, this level of detail is appropriate and leaves no significant gaps for the agent.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds value by providing concrete examples for type_name and to_symbol, clarifying auto-detection for project_root, and explaining the default/clamping behavior of timeout_ms. These enrich understanding beyond the schema's own descriptions.

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 opens with a specific verb and resource: 'Trace how C/C++ data of a given type flows to a target function via libclang call paths.' It clearly distinguishes itself from sibling tools by noting that it maps call paths across translation units, which 'text-based search cannot trace,' and references the find_* family for alternative exact queries.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: it says when the tool is most useful ('synchronous driver stacks'), when it is not appropriate ('Cannot follow async flows'), and names alternatives ('For exact call-graph queries use the find_* family; verify specific paths with find_call_path'). This gives the AI agent clear decision criteria.

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/turbyho/fw-context-mcp'

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