Skip to main content
Glama

Get one symbol implementation

ast_get_symbol_source
Read-onlyIdempotent

Retrieve a single declaration or implementation from a TypeScript or JavaScript project, returning its project-relative location instead of the full file. Specify a symbol path to pinpoint the exact code you need.

Instructions

Returns exactly one declaration or implementation with its project-relative location, not the complete file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesProject-relative or absolute source file path.
symbol_pathYesSymbol path such as "formatDate" or "UserService.create".
project_rootYesAbsolute project directory containing tsconfig.json, or the config path.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
textYes
endLineYes
startLineYes
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is fully covered. The description adds the behavioral detail that it returns only one declaration and the project-relative location, not the full file. With robust annotations, the bar is lower, and the description adds reasonable context about output granularity without contradicting annotations.

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?

Single sentence, zero fluff, front-loaded with the core action ('Returns exactly one declaration'). Every word earns its place. The 'not the complete file' qualifier is valuable disambiguation rather than filler.

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?

Given the tool's low complexity (3 params, all documented), the annotations fully covering safety, and the existence of an output schema, the description is complete for the retrieval use case. It clarifies output granularity (single symbol vs file) which is a meaningful detail. Could note return format but the output schema covers that. Slightly more example context could push it to 5.

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 all three parameters (project_root, file_path, symbol_path) are already documented in the schema with clear descriptions. The description itself does not add meaning beyond the schema, but per the baseline rule, 3 is appropriate when schema does the heavy lifting. Symbol path format like 'formatDate' or 'UserService.create' is already illustrated in the 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?

The description is specific: 'Returns exactly one declaration or implementation with its project-relative location, not the complete file.' The verb 'returns' clearly states the action, the resource is a specific symbol declaration/implementation, and it explicitly distinguishes from returning the complete file. This differentiates it from sibling tools like ast_search_symbols (search/broadcast) and ast_find_references (locations), setting a clear scope of single-symbol retrieval.

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 description implies usage for retrieving a single symbol's declaration, but does not explicitly state when to prefer this over siblings like ast_search_symbols or ast_get_outline. The 'not the complete file' clause offers some contrast, but there is no explicit when/when-not guidance or named alternatives. Context is clear for a basic retrieve operation but lacks directional guidance.

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/yailPeralta/ast-mcp-server'

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