Skip to main content
Glama

lookup_symbol

Look up C/C++ symbols by exact name or prefix match via libclang index, uncovering build-conditional code, template instantiations, and macro-expanded names that grep cannot detect.

Instructions

USE INSTEAD OF grep, ctx_search, or ctx_symbol. Look up a C/C++ symbol by name via libclang index — exact or prefix matching.

Finds symbols grep cannot see: build-conditional code, template instantiations, macro-expanded names. 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. 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 provided, so description carries full burden. Discloses read-only nature and non-blocking auto-reindex. Also details return format beyond output schema. Minor: some return detail repeated from schema.

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 bold directive, purpose, advantages, behavioral note, then parameter and return details. Slightly verbose but each sentence adds necessary context. Front-loaded with most critical info.

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 complexity of C/C++ symbol lookup with libclang, full schema coverage, and output schema present, description is highly complete. Includes behavioral notes, parameter examples, and detailed return field descriptions.

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%, baseline 3. Description adds value with usage examples (e.g., 'uart_init' vs 'uart_'), clarifies default behavior for exact, and mentions limit cap of 100. Enhances schema meaning.

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?

Clearly states it looks up C/C++ symbols by exact or prefix matching via libclang index. Distinguishes from sibling tools like grep, ctx_search, ctx_symbol, and search_code with specific examples.

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

Usage Guidelines4/5

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

Explicitly advises 'USE INSTEAD OF' grep and similar tools. Specifies when to prefer this over search_code (when exact symbol name or prefix is known). Lacks explicit 'when not to use' but context is strong.

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