Skip to main content
Glama

read_symbol

Retrieves exact source code for a function, class, or method by symbol ID so agents can inspect only the needed symbol's lines, signature, and docstring instead of the full file.

Instructions

Retrieves exact source code of a function, class, or method by symbol ID. Returns only that symbol's lines, signature, and docstring. ~50-200 tokens vs ~2000 for reading the full file.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "symbol_id": "<symbol_id>"
    },
    "name": "read_symbol"
  }
}

Input Schema

NameRequiredDescriptionDefault
repoNoFilter to a specific repository (as shown in list_repos)
verifyNoVerify content hasn't drifted since indexing
symbol_idYesSymbol identifier (from search_symbols or get_file_outline results)
context_linesNoNumber of surrounding lines to include

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.10.2

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full disclosure burden. It does state the return contents (lines, signature, docstring) and the token-cost profile, which is useful behavioral context, but it says nothing about failure behavior for an unresolved symbol_id, cross-repo scoping, or what verify actually checks or costs.

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?

Three short sentences, front-loaded with the core action, then output shape, then the cost rationale. No filler and nothing redundant with the schema.

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

Completeness4/5

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

For a single-symbol read tool with full schema coverage and no output schema, the description is largely complete: it says what comes back and why it is cheaper than a file read. The remaining gap is guidance on sibling selection (understand_symbol, read_symbols) and error/not-found behavior.

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 every parameter (repo, verify, symbol_id, context_lines) is already documented in structured data, setting the baseline at 3. The description adds only the notion of addressing by symbol ID and does not elaborate on verify semantics or context_lines usage beyond the schema.

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

Purpose4/5

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

The description gives a specific verb and resource ('Retrieves exact source code of a function, class, or method') and scopes the result to one symbol's lines, signature, and docstring. It clearly distinguishes itself from reading a whole file, but never names or contrasts with its closest sibling, understand_symbol, so an agent must still guess between retrieving source and understanding a symbol.

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 token-cost comparison ('~50-200 tokens vs ~2000 for reading the full file') implies when this tool beats a whole-file read, and the schema points at search_symbols/get_file_outline as symbol_id producers. However, there is no explicit when-not guidance and no named alternative (e.g., understand_symbol for explanation, read_symbols for batch), leaving sibling selection to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.