Skip to main content
Glama
aimasteracc

tree-sitter-analyzer

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
TREE_SITTER_OUTPUT_PATHNoOptional path for large output write target.
TREE_SITTER_PROJECT_ROOTYesAbsolute path to the project root directory.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": true
}
resources
{
  "subscribe": true,
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
searchA

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=content — ripgrep text/regex search across files. Params: query, roots, include_globs, ...

  • action=grep — two-stage fd (file discovery) + ripgrep search. Params: query, roots, ...

  • 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.

navA

Code-intelligence (codegraph-compatible) navigation facade. Covers codegraph_navigate, codegraph_callers, codegraph_callees, codegraph_call_path, codegraph_xref, codegraph_impact, codegraph_context, codegraph_trace, and symbol lineage/resolve in one tool. START HERE for any 'how does X work' / trace / call-flow / understand-a-class question: call action=context FIRST (ONE call composes definition + callers + callees + code for a task), then action=callee_tree or caller_tree for the FULL traversal tree in ONE call. These replace many search/navigate/Read round-trips — do NOT loop search or per-symbol navigate; reach for the tree/context actions instead. Pick a capability via action:

  • action=navigate — go-to-definition / symbol navigation (codegraph_navigate equivalent). Params: symbol (required), mode (full|references|callers|callees).

  • action=call_path — BFS execution path between two functions ('how does A reach B?', codegraph_call_path equivalent). Params: source_function, target_function, source_file, target_file, direction (forward|backward|bidirectional), max_depth, max_paths.

  • action=xref — cross-reference lookup (who uses this symbol or file, codegraph_xref equivalent). Params: symbol, mode (symbol|file), file_path.

  • action=resolve — go-to-definition + find-all-references for a symbol. Params: symbol (required), mode (resolve|references), output_format.

  • action=lineage — class/function inheritance and override lineage. Params: symbol (required), output_format.

  • action=impact — blast-radius / risk scoring for a function or set of functions (codegraph_impact equivalent). Risk score computed from PRODUCTION edges only; tests bucket (test_callers_count, test_callees_count) always present. Params: mode (function_impact|blast_radius|risk_score), function_name, function_names, file_path, depth, include_tests (bool, default false — when true adds test_caller_files/test_callee_files to tests bucket).

  • action=trace — full impact trace from a symbol outward (codegraph_trace equivalent). Params: symbol (required), output_format.

  • action=context — one-call focused context for a task/symbol: composes search + definition + callers + callees in a single capped response (codegraph_context equivalent). Params: task (required — natural-language description or symbol name), max_nodes, max_code_blocks, output_format.

  • action=callers — who calls a function (codegraph_callers equivalent). scope=point (default) → direct 1-hop callers (fast). Params: function_name/symbol (required), file_path, output_format. scope=graph → full call-graph traversal (callers mode). Params: function_name/symbol (required), file_path, depth, output_format.

  • action=callees — what a function calls (codegraph_callees equivalent). scope=point (default) → direct 1-hop callees (fast). Params: function_name/symbol (required), file_path, output_format. scope=graph → full call-graph traversal (callees mode). Params: function_name/symbol (required), file_path, depth, output_format.

  • action=callee_tree — depth-limited NESTED tree of everything a function transitively calls, in ONE call (no per-node iteration). Prefer this over looping action=callees. Params: symbol (required), file_path, max_depth (default 3, cap 10), max_nodes (default 150), output_format.

  • action=caller_tree — depth-limited NESTED tree of everything that transitively calls a function (blast radius), in ONE call. Params: symbol (required), file_path, max_depth, max_nodes, output_format.

  • action=test_map — which tests exercise a function (test-file callers, by file and test function name). Use BEFORE editing to know the test surface. Returns test_files (sorted, deduplicated), test_functions in 'file::fn' format (paste directly into pytest), edge_count (raw call edges across all resolved targets), unique_function_count (post-dedup; truncated is keyed to this), truncated flag (cap=50 unique functions). Params: symbol (required), file_path, output_format.

  • action=co_change — git-history temporal coupling: files that historically change together with a file or symbol (lift-ranked). Use BEFORE editing to find implicit coupling that the call graph cannot see (config+code, schema+handler, proto+generated stub). Params: symbol or file_path (one required), max_commits (default 500), min_shared (default 3), max_results (default 20), output_format.

structureA

Code-intelligence (codegraph-compatible) structural analysis facade. Covers codegraph_explore (multi-symbol source), codegraph_class_hierarchy, codegraph_class_inspect, codegraph_sitemap, codegraph_ast_path, and code-outline/complexity in one tool. Pick a capability via action:

  • action=outline — AST-based symbol outline for a file or directory. Params: file_path, language, depth.

  • action=analyze — complexity + structure analysis (cyclomatic, nesting, cohesion). Params: file_path, language.

  • action=signatures — LIGHTWEIGHT method-directory (~25 %% of full tokens). Lists every method as 'name →returnType(Np) startLine-endLine' grouped by class. Use FIRST for large files (>500 lines) to pick methods by name, then action=read to fetch bodies. Supports Python, Java, and other languages. Params: file_path[, language] (language auto-detected from file extension when omitted).

  • action=ast_path — AST path from a specific node up to the file root (navigate the parse tree, codegraph_ast_path equivalent). Params: file_path, line, column.

  • action=sitemap — high-level symbol sitemap of a directory or the whole project (what is defined where, codegraph_sitemap equivalent). Params: mode (full|api|module|flat), directory (relative path, optional), language, max_files. NOTE: takes a directory, not file_path — omit directory for the whole project.

  • action=class_tree — class inheritance/subclass hierarchy (codegraph_class_hierarchy equivalent). Params: class_name, mode (subclasses|superclasses|supers|tree|impact|all|summary). 'supers' is an alias for 'superclasses'.

  • action=class_detail — detailed class inspection: fields, methods, visibility, inherited members (codegraph_class_inspect equivalent). Params: class_name (or query as alias), language.

  • action=explore — multi-symbol source explorer: show source of several related symbols grouped in one capped response (codegraph_explore equivalent). Params: symbols (list) or symbol/query (string), maxSymbols, maxFiles.

  • action=read — extract a file section (single) or multiple sections (batch). Single: file_path + start_line [+ end_line + column bounds]. Batch: requests=[{file_path, sections:[{start_line, end_line}]}].

healthA

Code-intelligence (codegraph-compatible) health and analysis facade. Covers codegraph_complexity_heatmap, codegraph_import_graph, codegraph_dependency_matrix, codegraph_dead_code, codegraph_overview, and project/file health metrics in one tool. Pick a capability via action:

  • action=project — overall project code-quality grade + per-file grade breakdown. Params: min_grade, max_files.

  • action=file — per-file health: complexity, duplication, style. Params: file_path (required), language.

  • action=scale — lines-of-code / complexity / size metrics. Params: file_path, file_paths, language, metrics_only, include_complexity, include_details, include_guidance.

  • action=patterns — anti-pattern detection by category and severity. Params: file_path (required), categories, severity_threshold.

  • action=heatmap — complexity heatmap ranked by file or function (codegraph_complexity_heatmap equivalent). Params: mode, file_path, function_name, language, directory, max_files.

  • action=imports — module import dependency graph (who imports whom, codegraph_import_graph equivalent). Params: mode, file_path, max_depth.

  • action=matrix — coupling matrix and top-k coupling ranks (codegraph_dependency_matrix equivalent). Params: mode, file_path, top_k, threshold.

  • action=dead — unreferenced functions / unused imports / unused variables (codegraph_dead_code equivalent). Params: mode, include_test_files, max_dead, max_imports, max_variables.

  • action=routes — HTTP route discovery across framework conventions. Params: mode, url_pattern, file_path, framework.

  • action=overview — entry-points / hub files / dead-code summary (codegraph_overview equivalent). Params: max_entry_points, max_hubs, max_dead, max_coupled_files.

  • action=deps — dependency analysis (R5 multi-mode). Params: mode (summary|cycles|blast|file_deps), file_path. mode=summary: project-level dependency overview. mode=cycles: detect circular dependencies. mode=blast: blast-radius for a given file_path. mode=file_deps: file-level dependency details.

  • action=test_gap — untested symbol discovery ranked by cyclomatic complexity. Params: mode (summary|gaps|file), file_path, language, max_files, max_gaps, include_covered, output_format. For UML diagrams, call/dependency graph visualizations, and similarity analysis, use the viz facade instead.

editA

Code-intelligence (codegraph-compatible) safety and change-management facade. Covers codegraph_pr_review (PR analysis via codegraph), safe-to-edit gates, blast-radius guards, change impact scanning, refactoring suggestions, constraint checks, semantic classification, and AST diff in one tool. Pick a capability via action:

  • action=safe — pre-edit safety gate: is this file safe to edit right now? Returns SAFE/UNSAFE verdict. Params: file_path, edit_type, output_format.

  • action=guard — blast-radius guard BEFORE touching a symbol: how many callers, what test coverage, what risk level. Params: symbol* (required), modification_type* (required), file_path.

  • action=impact — post-edit dependency blast-radius scan combining git diff + dependency graph: affected files, must-run tests, risk verdict (SAFE/REVIEW/WARN). Call after every non-trivial edit. Params: mode (diff|staged|branch|pr, default: diff), scope_paths, output_format.

  • action=refactor — refactoring-opportunity analysis for a source file: extract candidates, complexity hotspots, skeleton. Params: file_path, language, max_suggestions, include_extractions, include_skeleton, output_format.

  • action=constraints — scan the project for constraint/rule violations (architecture, naming, coupling). Params: severity_min, output_format.

  • action=pr — AI review of a PR diff via codegraph: structural issues, blast-radius, test-coverage gaps (codegraph_pr_review equivalent). Params: pr_url or diff (see inner schema).

  • action=classify — semantic change classification: classify a file's diff between git refs (file_path [+ old_ref/new_ref]) or two code strings (old_source + new_source + language). With only file_path, defaults to the file/git-ref mode. Params: file_path | old_source+new_source+language, output_format.

  • action=ast_diff — structural AST diff between two snapshots/versions of a file: added/removed/changed nodes. Mode is inferred from args when omitted. Modes: diff_files (old_file + new_file), diff_strings (old_source + new_source + language), diff_git (old_ref + new_ref + file_path). Params: see inner schema. NOTE: safe/impact/classify/constraints/pr/ast_diff are read-only in practice; refactor/guard suggest changes but do not write files. readOnlyHint is False for the whole facade (mixed action set).

projectA

Code-intelligence (codegraph-compatible) project-intelligence hub. Covers codegraph_metrics (graph-level stats), project overview, file enumeration, smart task-focused context, parser readiness, agent skills/workflow, decision journal, and doc sync in one tool. Pick a capability via action:

PROJECT INFO (read-only):

  • action=overview — high-level summary of languages, entry points, and architecture. Best first call on an unfamiliar repo. Params: format.

  • action=files — enumerate source files with filtering. Params: path, extensions, limit, format.

  • action=smart — one-shot orientation for a single file: file_health grade, exported symbols (the file's public API), upstream/downstream dependencies, associated test files, and edit-risk in one envelope (replaces Read + file_health + dependency_analysis + safe_to_edit). Params: file_path.

  • action=parser — check tree-sitter parser readiness for the project languages. Params: format.

  • action=tools — verify availability of CLI tools (ripgrep, fd, etc.). Params: (none).

  • action=metrics — codegraph graph-level statistics (node/edge counts, top hubs, codegraph_metrics equivalent). Params: format.

  • action=skills — enumerate available agent skills for this project. Params: format.

  • action=workflow — recommended agent workflow for the current task type. Params: task_type, format.

DECISION + DOC (may write):

  • action=journal — persistent architectural decision journal. Params: mode (record/get/search/supersede), title, rationale, verdict, query, verdict_filter, id, new_id, scope_paths, alternatives, related_symbols, tags, path_scope, limit.

  • action=doc_sync — sync documentation to current code state. Params: path, dry_run.

For index lifecycle (status/build/full/auto/sync/cache), use the index facade instead.

indexA

Code-intelligence (codegraph-compatible) index lifecycle hub. Covers codegraph_status, codegraph_full_index, codegraph_autoindex, codegraph_incremental_sync, and AST cache query in one tool. Pick a capability via action:

READ-ONLY:

  • action=status — check codegraph index health without writing (codegraph_status equivalent). Returns node/edge counts, staleness, and error indicators. Params: (none).

  • action=cache — query the raw AST cache for symbols, types, and references (read-only modes: search, lookup, stats, changes, watch_status). NOTE: this action ALSO exposes mutating cache modes via mode — index, sync, invalidate, watch_start, watch_stop (and force=true to force a reindex). Params: mode (default search/stats), query, file_path, kind, limit, force.

WRITES ON-DISK INDEX:

  • action=build — full (re)build of the project index. Slow; use when index is absent or corrupt. Params: force.

  • action=full — force a complete full reindex (codegraph_full_index equivalent). Params: (none).

  • action=auto — enable/configure background auto-indexing (codegraph_autoindex equivalent). Params: enable, watch.

  • action=sync — run one incremental sync pass (fast; use after editing files, codegraph_incremental_sync equivalent). Params: paths.

vizA

Code-intelligence (codegraph-compatible) visualization and similarity facade. Covers codegraph_uml (UML diagrams), codegraph_visualize (call/dependency graph visualizations), and codegraph_similarity (duplicate code detection) in one tool. Pick a capability via action:

  • action=uml — UML class or sequence diagrams (codegraph_uml equivalent). Params: diagram, source, target, max_edges, max_depth, max_paths, package_depth, include_external_bases, file_path, class_name, include_tests.

  • action=graph — call/dependency graph visualizations (codegraph_visualize equivalent). Params: mode, file_path, function, depth, max_edges, direction.

  • action=similarity — duplicate / near-duplicate code detection (codegraph_similarity equivalent). Default response is a summary map (files, line ranges, scores — no bodies). Params: mode, min_lines, min_group_size, max_groups, use_cache, include_bodies (set include_bodies=true to add code snippets; omit for the compact default).

set_project_pathA

SMART Workflow 'Set' step (FIRST): Set the project root path for security boundaries. Call this before any other tool to ensure correct file resolution and security validation.

Prompts

Interactive templates invoked by user choice

NameDescription
smart_analyzeSMART Workflow: Systematic code analysis for a single file. Recommended for files you haven't seen before.
smart_exploreSMART Workflow: Explore a new project. Get the full picture before diving into code.

Resources

Contextual data attached and managed by the client

NameDescription
code_fileAccess to code file content through URI-based identification
project_statsAccess to project statistics and analysis data
Hyphae selector resultRe-evaluate a Hyphae selector expression and return the current result set. URI produced by search action=subscribe.

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/aimasteracc/tree-sitter-analyzer'

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