Skip to main content
Glama

explain_symbol

Explain C/C++ symbols in plain English: purpose, inputs, outputs, and side effects. Uses pre-computed analysis when available, falling back to on-demand LLM or macro explanation.

Instructions

Explain what a C/C++ symbol does in plain English — libclang-aware analysis. Uses pre-computed LLM analysis when available (instant), falls back to on-demand LLM. Falls back to macro explanation when the name matches a #define.

Read-only. No side effects — uses pre-computed LLM analysis when available (instant, generated during fw-context index --analyze), falls back to calling an LLM on-demand. Returns the symbol's purpose, inputs, outputs, and side effects.

For raw source code use get_source. For symbol metadata without explanation use lookup_symbol. For body + callers + callees use get_symbol_context.

Args: name: Symbol name to explain. E.g. uart_init, ModemMsg::send. project_root: Project root directory. Auto-detected if omitted. context_lines: Lines of source context around the symbol definition (default 40, max 200). Only used when no pre-computed analysis exists.

Returns: dict: {name, kind, file, line, signature, explanation, llm_analysis (if pre-computed)}, plus source/explain_prompt on fallback. Macro fallback returns kind="macro", signature (as #define NAME), value (raw definition), and expanded_value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSymbol name to explain. E.g. 'uart_init', 'ModemMsg::send'.
imageNoSysbuild image name within the variant (multi-project). Omit for all images of the variant.
variantNoBuild variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants.
project_rootNoProject root. Auto-detected if omitted.
context_linesNoLines of source context around the symbol definition.
Behavior5/5

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

With no annotations, the description carries full burden and excels: it declares 'Read-only. No side effects', explains pre-computed vs on-demand LLM fallback, macro fallback behavior, and output contents (purpose, inputs, outputs, side effects). No annotation contradiction.

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

Conciseness4/5

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

Well-structured with a summary line, behavioral details, alternative list, Args section, and Returns section. Slight redundancy (the pre-computed/on-demand LLM behavior is mentioned twice, and macro fallback appears in both intro and returns), but still efficient and easy to scan.

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?

For a tool with no output schema, the description thoroughly explains return values including the dict structure, macro fallback fields, and source/explain_prompt on fallback. It covers core behavior, contingencies, and alternatives, making it nearly self-sufficient for an 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 'name' (uart_init, ModemMsg::send), noting auto-detection for project_root, and specifying context_lines default (40) and max (200) plus when it is used. However, it omits the 'image' and 'variant' parameters, which are only in schema.

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?

Description uses a specific verb ('Explain') and resource ('C/C++ symbol') with a clear qualifier ('in plain English — libclang-aware analysis'). It distinguishes from siblings by explicitly naming alternative tools (get_source, lookup_symbol, get_symbol_context) with their different purposes.

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?

Explicit when-to-use guidance is provided via alternative tool references: 'For raw source code use get_source. For symbol metadata without explanation use lookup_symbol. For body + callers + callees use get_symbol_context.' This gives clear exclusions and alternatives.

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