Skip to main content
Glama

ast_query

Query a source file's abstract syntax tree using raw tree-sitter S-expressions to access AST structures beyond typed tools.

Instructions

Run a raw tree-sitter S-expression query against one file.

The escape hatch for anything the five typed tools flatten away.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
queryYes
capturesNo
max_tokensNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description carries full behavioral disclosure burden. It only says what the tool does, not whether it is read-only, what the output looks like, whether the file can be modified, or any error/edge-case behavior. The word 'query' hints at a read operation, but this is not explicit.

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?

Two sentences with no fluff. The primary action is front-loaded, and the second sentence adds valuable positioning as an escape hatch. Every word earns its place.

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

Completeness2/5

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

Given no output schema, no annotations, and 0% schema description coverage, the description is insufficient for a 4-parameter tool. It does not mention return format, capture behavior, token limits, or how this low-level query relates to the typed tools beyond being a fallback. Agents would likely need extra probing to use it correctly.

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 description coverage is 0%, so the description must compensate. It indirectly explains 'path' ('against one file') and 'query' ('raw tree-sitter S-expression query'), but gives no guidance on 'captures' or 'max_tokens' semantics, defaults, or usage. With 4 parameters and no schema descriptions, this leaves significant ambiguity.

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?

States a specific action: 'Run a raw tree-sitter S-expression query against one file.' This clearly identifies the verb, resource, and scope. It also differentiates itself from siblings by calling itself 'the escape hatch for anything the five typed tools flatten away,' signaling it is the lower-level fallback.

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?

Provides clear context by positioning the tool as an escape hatch, implying it should be used when the five typed tools (search_symbols, get_docstrings, file_outline, get_symbol, list_imports) cannot express the desired query. It does not name specific sibling alternatives or give explicit when-not-to-use conditions, but the context is actionable.

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

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/matthew-brough/AST_MCP'

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