Skip to main content
Glama
aimasteracc

tree-sitter-analyzer

by aimasteracc

search

Read-onlyIdempotent

Locate code symbols, run AST/DSL queries, batch text patterns, trace call graphs, and perform semantic lookup across a codebase from one action-based MCP tool.

Instructions

Code-intelligence (codegraph-compatible) search facade. Covers codegraph_symbol_search (BM25), codegraph_query (tree-sitter AST), codegraph_query chain DSL, and ripgrep/fd text search in one tool. Pick a capability via action:

  • action=symbol — BM25 FTS lookup of a symbol by name (fast 'where is X defined', codegraph_symbol_search equivalent). Params: query, language, kind, limit.

  • action=query — tree-sitter .scm query DSL (semantic AST match, NOT the same as symbol). Params: query_key, query_string, filter, file_path.

  • action=batch — run multiple ripgrep searches in one call. Params: queries (required array of 2-10 items; each item requires pattern and may include roots/include_globs/exclude_globs/max_results/label), output_format.

  • action=chain — jQuery-style codegraph chain DSL: compose search / explore / callers / callees in one process. Steps are separated by '.' (NOT '|'), e.g. query="search('IndexShard').callers()" or "explore('parse').related()"; a plain string with no parentheses is treated as explore(string).related(). Params: query (required — the chain string), max_symbols, max_files, include_code, compact.

  • action=select — Hyphae DSL, a CSS-selector-style graph query (RFC-0003). ONE selector replaces chains of navigate/callers/search: #name, .kind (.function/.method/.class), *, :calls(#X), :callees(#X), :not(sel), :in(path), [file=p]/[language=l]/[class=C], combinators A > B / A B. Example: '.function:calls(#IndexShard):in(server/)'. Params: selector (required), max_results, output_format.

  • action=subscribe — RFC-0001 reactive push: subscribe to a Hyphae selector. Receive send_resource_updated when results change; re-read resource_uri. Returns { sub_id, resource_uri }. Params: selector (required), min_interval.

  • action=unsubscribe — cancel a Hyphae subscription. Params: sub_id or selector.

  • action=tql_schema — full TQL (extended Hyphae) DSL reference: temporal pseudo-classes (:hot/:stale/:hotspot), depth quantifier {n,m}, :violates, :reaches, :branch, plus all standard Hyphae pseudo-classes. Call once at session start. Params: (none).

  • action=tql_execute — execute a TQL (Temporal Query Language) selector: Hyphae extended with DepthQuantifier {n,m} bounded BFS, temporal pseudo-classes, reachability, architecture violations, and branch context. Call action=tql_schema first for the grammar. Params: selector (required), max_results.

  • action=semantic — find symbols semantically similar to a natural-language query via vector embeddings (requires numpy + embedding pipeline). Params: query (required), top_k, min_similarity, language, kind, use_combined_score.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNoSymbol kind filter for action=symbol (default: any).
modeNoAction sub-mode (e.g. summary|cycles).
limitNoMax results.
queryNoSearch query/pattern.
scopeNoAction discriminator (e.g. point|graph).
actionYesWhich capability to invoke. One of: batch, chain, query, select, semantic, subscribe, symbol, tql_execute, tql_schema, unsubscribe
symbolNoSymbol/function name.
languageNoLanguage hint (usually auto).
file_pathNoTarget file path.
function_nameNoFunction name (alias of symbol).
output_formatNoOutput format: JSON.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.30.0
    • changedInput schema / properties / action / description
      Previous value: -"Which capability to invoke. One of: batch, chain, content, grep, query, select, subscribe, symbol, unsubscribe"New value: +"Which capability to invoke. One of: batch, chain, query, select, semantic, subscribe, symbol, tql_execute, tql_schema, unsubscribe"
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "batch",
      -  "chain",
      -  "content",
      -  "grep",
      -  "query",
      -  "select",
      -  "subscribe",
      -  "symbol",
      -  "unsubscribe"
      -]New value: +[
      +  "batch",
      +  "chain",
      +  "query",
      +  "select",
      +  "semantic",
      +  "subscribe",
      +  "symbol",
      +  "tql_execute",
      +  "tql_schema",
      +  "unsubscribe"
      +]
    • changedInput schema / properties / output_format / description
      Previous value: -"Output format (toon|json)."New value: +"Output format: JSON."
    • addedInput schema / properties / output_format / enum
      Added value: +[
      +  "json"
      +]
  2. Changed1 schema field changedv1.25.0
    • addedInput schema / properties / kind
      Added value: +{
      +  "description": "Symbol kind filter for action=symbol (default: any).",
      +  "enum": [
      +    "function",
      +    "method",
      +    "class",
      +    "enum",
      +    "variable",
      +    "import",
      +    "constant",
      +    "any"
      +  ],
      +  "type": "string"
      +}
  3. First observedv1.23.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, destructiveHint=false, openWorldHint=false), so the bar is lower. The description adds real behavioral context beyond the annotations: subscribe produces a push notification ('send_resource_updated') and returns { sub_id, resource_uri }, unsubscribe cancels a subscription, and semantic search has an external dependency. It does not describe latency/cost or failure behavior, so it is not a 5.

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?

The text is long, but the facade genuinely has ten distinct capabilities, and it is cleanly structured: a one-line identity followed by a consistent per-action bullet with scope, params, and syntax examples. Front-loaded and scannable; the length is mostly earned 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?

For a ten-action facade with no output schema, the description does a good job supplying grammars, examples, prerequisites, and the one return shape it documents (subscribe). It under-specifies what the other actions return, which is the main gap, but overall it is complete enough to invoke each action correctly.

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

Parameters4/5

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

Schema coverage is 100% but the schema's own descriptions are generic ('Search query/pattern.', 'Action sub-mode'), so the description carries meaningful extra weight: it maps action-specific params (query_key/query_string/filter/file_path for query, a required 2-10 item queries array with mandatory pattern for batch, selector for select/tql_execute, sub_id for unsubscribe). This goes beyond the structured fields, so it exceeds the baseline 3.

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 opens with a precise identity ('code-intelligence search facade') and enumerates each of the ten actions with the specific verb/resource it performs (BM25 symbol lookup, tree-sitter AST query, chain DSL, Hyphae selector, TQL, semantic vectors). An agent can tell which sub-capability it needs. It does not explicitly differentiate itself from siblings like nav or structure, which may overlap on graph traversal, so it falls short of a 5.

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?

Usage is spelled out per action, including sequencing rules ('Call action=tql_schema first for the grammar', 'Call once at session start') and prerequisites ('requires numpy + embedding pipeline'). What is missing is explicit when-not-to-use guidance or routing away from siblings (nav/structure), which would be needed for a 5.

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