Skip to main content
Glama

lookup_symbol

Look up C/C++ symbols by exact name or prefix using libclang indexing. Finds build-conditional code, template instantiations, and macro-expanded names missed by text search.

Instructions

Look up a C/C++ symbol by name via libclang index — exact or prefix matching. Finds symbols text-based search can miss: build-conditional code, template instantiations, macro-expanded names. Prefer this when you know the exact symbol name or prefix. Falls back to macro lookup.

Finds symbols text-based search can miss: build-conditional code, template instantiations, macro-expanded names. Macros are extracted via clang -dM -E during indexing so #ifdef-conditional macros resolve correctly for the active build config. Prefer this over search_code when you know the exact symbol name or a prefix (uart_ finds all UART symbols). Use search_code for keyword/concept search.

Read-only: yes. May auto-reindex stale files (non-blocking).

Args: name: Symbol name (exact match) or prefix (set exact=False). E.g. 'uart_init' finds the exact function; 'uart_' finds all symbols starting with 'uart_'. project_root: Project directory. Auto-detected if omitted. exact: True = exact name match, False = prefix LIKE match (default). limit: Maximum results (default 50).

Returns: list[dict]: Symbols with name, qualified_name, kind, file, line, signature, docstring, is_definition, is_template, is_virtual, is_pure_virtual fields. Enum constants include enum_value with the integer value. Macro results include kind="macro", value (raw definition), and expanded_value (preprocessor- resolved value). May also include template_usr, parent_usr, summary, inputs, outputs when available. When no results found, may include _did_you_mean with suggested symbol names. Empty list if not found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSymbol name. Exact match if exact=True, prefix LIKE match otherwise. E.g. 'uart_init' or 'uart_'.
exactNoTrue = exact name match, False = prefix LIKE match (default).
limitNoMaximum results returned (capped at 100, default 50).
project_rootNoProject root directory. Auto-detected from CWD if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It states 'Read-only: yes. May auto-reindex stale files (non-blocking).' It also details the indexing method (libclang, clang -dM -E) and that macros are extracted for correct build config resolution. This is above average behavioral disclosure.

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?

The description is somewhat lengthy but well-structured with an introductory sentence, usage guidance, parameter details, and return format. It is front-loaded with the core purpose. While a bit verbose, every section adds value and there is no wasted text.

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?

Given the tool's complexity and the presence of an output schema (not shown), the description thoroughly covers behavior, parameters, return values, and edge cases (e.g., _did_you_mean). It explains macro handling, enum values, and template instances. This is comprehensive for an AI 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 the baseline is 3. The description adds value with examples (e.g., 'uart_init' vs 'uart_'), explains default behavior for exact=False, auto-detection for project_root, and the limit cap. This enhances understanding beyond the schema 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 clearly states 'Look up a C/C++ symbol by name via libclang index — exact or prefix matching.' It differentiates from sibling tools by explicitly comparing to search_code, noting that this tool finds symbols that text-based search can miss.

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 guidance: 'Prefer this over search_code when you know the exact symbol name or a prefix... Use search_code for keyword/concept search.' It also mentions fallback to macro lookup and explains when to use exact vs prefix matching.

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