Skip to main content
Glama

read_symbol

Retrieve source text for a function, class, or variable by name without loading the whole file. Choose full source, interface skeleton, or signature-only.

Instructions

Return source text for a single named symbol (function, class, method, config key) without reading the entire file. Read-only.

depth controls how much is returned:

  • "full" (default): Entire source of the symbol. Typical savings: 10-20x fewer tokens than reading the whole file.

  • "interface": For a class -> header + field declarations + method signatures with bodies replaced by ' ...'. For a function -> just the signature.

  • "signature": Signature-only. For a function -> the line(s) before the body. For a class -> the class header.

Use this when: You need to read a specific symbol without reading the whole file. Pick the narrowest depth that contains what you need. Don't use this when: You need a structural overview of the whole file -> use list_symbols. You need to see the file's imports -> use read_imports.

Example: target="LRUCache.get" # full method source target="LRUCache", depth="interface" # class skeleton target="LRUCache.get", depth="signature" # just the def line target="project.version" # config value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
targetYes
depthNofull

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations are provided, so the description must fully disclose behavior. It declares the tool as 'Read-only' and explains the three depth options in detail, including what each returns for different symbol types. Examples illustrate typical usage, ensuring the agent understands the tool's behavior and token savings.

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?

The description is well-structured with clear sections, bullet points, and a separate example list. It is front-loaded with the core purpose, then details depth options, usage guidelines, and concrete examples. Every sentence adds value without redundancy.

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 that the tool has three parameters and an existing output schema (so return values don't need explanation), the description covers all necessary aspects: purpose, when to use vs. alternatives, depth semantics, and examples. It is complete for an agent to select and invoke the tool correctly.

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?

The input schema has 0% description coverage, so the description must compensate. It thoroughly explains the 'depth' parameter with semantic meaning and default value. However, the 'file_path' and 'target' parameters are not explicitly described; their meaning is only implied through examples. While the examples are helpful, a direct explanation of what 'target' represents (e.g., 'a dot-separated path to a symbol') would improve clarity.

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 starts with 'Return source text for a single named symbol', which is a specific verb+resource. It explicitly differentiates from siblings by stating what it does not do (e.g., 'without reading the entire file') and contrasts with list_symbols and read_imports for different use cases.

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: 'Use this when: You need to read a specific symbol...' and 'Don't use this when: You need a structural overview... use list_symbols. You need to see the file's imports... use read_imports.' It also recommends picking the narrowest depth.

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/kambleakash0/ast-editor'

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