Skip to main content
Glama

get_ast

Retrieve the function-level AST (CodeXM JSON) for a specified function to inspect its structure. Requires the AST to be exported during indexing.

Instructions

获取函数级 AST(CodeXM 模型 JSON)。需要索引阶段已导出该函数 AST。

Input Schema

NameRequiredDescriptionDefault
fnYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3/5.0
Behavior2/5

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

No annotations exist, so the description carries the full behavioral burden. It usefully discloses an index-time dependency, but says nothing about what happens when the precondition fails, whether the call is read-only, or how large the payload may be.

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?

Two short sentences, front-loaded with the purpose before the prerequisite. Nothing is padded, though the brevity leaves the gaps noted above.

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

Completeness3/5

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

The output schema covers the return value and there is only one parameter, so the bar is moderate. Still missing is any indication of the `fn` format or failure behavior for a tool whose main risk is not having the AST exported.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and the description never explains the single `fn` parameter — not its expected format (qualified name, signature, id), nor how to obtain a valid value from list_entities or search_entities. '函数级' only echoes that the argument is a function.

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?

States a specific verb and resource: get a function-level AST, and even names the serialization format (CodeXM model JSON). It is distinguishable from siblings like get_definition or who_calls by the AST output, though it never explicitly contrasts itself with them.

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?

It gives a prerequisite — the function AST must have been exported during indexing — which implies this is only usable for already-indexed functions. It never says when to choose it over get_definition or another sibling, and offers no explicit exclusions.

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