Skip to main content
Glama

kimi-tree-lens

Syntax-tree X-ray for Kimi Code

License: MIT Node Languages Built for

English | 简体中文


Why

Reading whole files wastes context, and Grep finds strings but cannot express structure — "every assignment to a field inside a constructor" is out of its reach. kimi-tree-lens compiles tree-sitter to WASM and serves it over the Model Context Protocol, so the agent queries the syntax tree instead — inside strict path confinement and hard resource caps:

  • Outline instead of read — list a file's definitions with line ranges, then fetch only the one method that matters.

  • Structural search — S-expression queries capture AST shapes string tools cannot express.

  • Workspace-scale navigation — a persisted, incrementally-refreshed symbol index answers "where is this defined / called" across tens of thousands of files.

  • Security audits as presets — dangerous-pattern queries (eval/exec, subprocess with shell=, innerHTML assignment, JDBC execute, System.exit, os/exec…) shipped built-in.

A managed plugin for Kimi Code.

Related MCP server: Lore MCP Server

Design philosophy

  • Keep context clean, no noise — the agent's most expensive resource is context; the outline-first, definition-second read path turns "look at one method" from ingesting a whole file into one precise hit.

  • No built-in LSP server — LSP serves humans inside editors (completion, diagnostics, sessions); this plugin serves an agent beside a codebase, and tree-sitter's granularity is exactly right for that without the extra weight.

  • Security fence — the agent points this tool at arbitrary code: path confinement, read-time re-validation, hash pinning and resource caps are not bolted-on features; they are the price of admission.

Supported languages

Java · Python · TypeScript · TSX · Go

Tools

Tool

Purpose

list_definitions

Outline a file (classes, functions, methods, fields...) with line ranges

cached_outline

Parse a file's outline and cache it (later calls on the same file are cache hits); cheap triage of search results before reading files

read_definition

Read one definition's source by exact name

ast_search

Run a tree-sitter query (S-expression pattern) against a file

index_workspace

Parse all supported sources under a directory into a symbol index

find_references / go_to_definition

Name-based navigation over the index; find_references accepts an optional file arg to scope results to one file (cheap disambiguation of same-named definitions)

callers / callees

Heuristic call-graph over the index; hits carry language + receiver + resolution confidence, optional file/language filters

resolution_stats

Measure resolution coverage of the whole index: exact/likely/name-only tiers, per-via breakdown, import resolution rate, same-name collision groups

index_status

Index state, totals, watcher status

delete_index

Drop an index: clears it from the session and deletes its persisted cache files; omit root when exactly one index exists

list_presets / preset_search

Built-in audit queries (eval/exec, subprocess, innerHTML, JDBC...)

get_node_types

Grammar node types and fields, for writing correct query patterns

analyze_complexity

Approximate cyclomatic complexity per function, worst first

Install

Prerequisite: Node.js ≥ 20.6.

In Kimi Code, run:

/plugins install https://github.com/zhaoxingxing06/kimi-tree-lens

Then /reload or start a new session — that's it. Installing automatically registers:

  • the tree-lens MCP server — all tools become available as mcp__tree-lens__*

  • 1 read-only sub-agent, tree-lens-tracer (call-chain tracing; see Sub-agents)

  • 3 hooks enforcing a read-before-edit gate (see Read-before-edit gate)

Plus the always-on usage prompt (SYSTEM.md) and the on-demand code-search skill. On first launch the MCP server installs its runtime dependencies automatically (one-time, needs network). Grammar WASMs for all five languages ship prebuilt and are SHA-256-verified at load time — no build step is ever required.

Sub-agents

Installing also registers 1 read-only sub-agent, tree-lens-tracer — it has no write tools and no index_workspace (indexing stays with the main agent), traces "who calls X / what does X call" through callers / callees / ast_search, and returns the chain as a box-drawn tree of nodes, each node backed by file:line evidence and a confidence tier.

Outline cache

The cached_outline(file) MCP tool parses a supported source file into a definition outline (name, kind, line ranges — no code) and caches it at ~/.kimi-code/tree-lens-hook/outlines/ keyed by size + mtimeMs; later calls on an unchanged file are cache hits. Use it to triage search results before deciding which files to read.

Read-before-edit gate

While the plugin is enabled, three hooks maintain per-session read state and surface call-site context around edits (fail-open: if a hook crashes or times out, the operation proceeds):

Hook

Event

Behavior

read-ledger.mjs

PostToolUse on Read/Edit/Write/Bash

Records every file the session touches into a per-session ledger

edit-gate.mjs

PreToolUse on Edit/Write

Blocks an edit once per symbol, only when it touches definitions whose exact or type-anchored call sites the session has not read yet, or whose same-named copies in other modules have drifted (body differs; universal method names like toString/equals are skipped) — re-issuing the same edit then passes. Stays silent when call sites are already read and copies are identical. Traces also append to the session traces.log (the callers query builds an index in the background if the project has none)

session-index-builder.mjs

SessionStart

Builds the workspace symbol index in the background so later queries are fast

Writing a brand-new file is always exempt (the target does not exist yet). Ledger state and the edit-trace traces.log live under ~/.kimi-code/tree-lens-gate/, keyed by session id + cwd.

Envelope the model receives on a block (placeholder data):

[tree-lens gate] edit paused once to surface impact info — re-issue the SAME edit to proceed (already recorded; the retry passes silently).
src/order/service.ts
call sites not read this session:
- calcTotal (function:120), called at:
    src/order/checkout.ts:88 (exact)
    src/order/invoice.ts:45 (exact)
cross-module drift:
- calcTotal: body differs in module-a, module-b (identical in module-c) — check whether this change should be ported
("not read" is ledger-based: full-file reads count as fully read; if you already know these, just re-issue.)
  • First line is the action: re-issue the same edit to proceed (at most one block per symbol per session)

  • call sites not read this session: exact or type-anchored call sites the session has not read yet

  • cross-module drift: same-named definitions in other modules whose bodies differ (universal method names like toString/equals are skipped); omitted when all copies are identical

  • When both sections are empty the edit passes silently

Troubleshooting

Symptom

Fix

Tools don't show up

Run /reload; check /plugins info tree-lens for diagnostics

First launch is slow or fails

The one-time dependency install needs network; if it fails (offline), run npm install --omit=dev inside ~/.kimi-code/plugins/managed/tree-lens

grammar hash mismatch

A grammar WASM was rebuilt or tampered; run npm run build:grammars to regenerate both the WASMs and lib/grammar-hashes.json

Unsupported file type / Node errors

The plugin needs Node.js ≥ 20.6; check node --version

Security model

This plugin is designed to be pointed at arbitrary code by an LLM agent:

  • Path confinement — every file/root argument must resolve (after realpath) inside the workspace roots advertised by the host, $TREE_SITTER_MCP_ROOTS, or the nearest project marker (.git, package.json, pom.xml, ...). Paths with no marker are rejected unless TREE_SITTER_MCP_ALLOW_UNCONFINED=1 is set explicitly.

  • Read-time re-validation — file paths are re-resolved and fence-checked inside the worker at read time, so symlink swaps between validation and I/O cannot escape the workspace.

  • Grammar integrity — every grammar WASM is SHA-256 pinned in lib/grammar-hashes.json; a mismatch refuses to load.

  • Resource caps — 1 MB per file, NUL-byte binary rejection, soft/hard deadlines per tool (timed-out workers are replaced), bounded index (SQLite default 20000 files / hard 100000; JSON fallback 1500 / 5000; depth 40) and bounded output sizes.

  • No network, no subprocess — the server only reads files under allowed roots and writes its index cache under ~/.kimi-code/tree-sitter-plugin-cache/.

Reference project benchmark report

metric

value

cold index (449 Java files, 4088 symbols)

~1.1s

scale · cold index

3.4s (~5846 files/s)

scale · single-file incremental re-index

213ms (parsed=1, reused=19999)

scale · query latency (200 randomized lookups)

p50 0ms / p95 1ms / max 150ms

scale · process RSS after index

~295 MB

License

MIT. Bundled grammar WASMs are built from the official tree-sitter-java/-python/-typescript/-go repositories (MIT licensed) at pinned tags; see build-wasm.sh for the exact versions.

Available Tools

15 tools
analyze_complexityCyclomatic complexity per functionA

Approximate cyclomatic complexity (1 + decision points: if/loops/case/catch/&&/||/ternary) per function in a source file, worst first.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesfile path
languageNooverride language inference

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It explains what the metric approximates, what counts as a decision point, and that results are sorted. It does not detail whether the file must be indexed or whether large files may be slow, but for a read-only analysis tool, this is reasonable.

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?

One efficient, well-structured sentence states the metric, the decision points, the scope, and the sort order. Every part adds information and no words are wasted.

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 tool with only two simple parameters and no output schema, the description covers the essential behavior. It could mention whether 'file' refers to a workspace-relative path or an absolute path, and could hint at the output shape, but those are minor gaps given the tool's simplicity.

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%, so the schema already documents the 'file' and 'language' parameters. The description adds value by clarifying that the file is a source file and that the analysis is per function, which is not stated in the parameter descriptions. The language enum is self-documenting.

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 states the tool computes approximate cyclomatic complexity per function in a source file, sorted worst first, and explicitly defines the formula. This makes the tool's purpose clear and distinguishes it from sibling tools like ast_search or find_references, which do different things.

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?

The description gives clear context for use: analyzing a source file for complexity metrics, with an optional language override. It does not explicitly name sibling alternatives or give when-not-to-use guidance, but the context is specific enough that an agent can infer when to use it.

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

calleesFind functions called by a functionA

Heuristic (name-based) call sites inside a function's body, grouped per callee name, with file, language, receiver object and a confidence tier (exact/likely/name) for the callee resolution. Same-named callees of different classes are grouped under one name; use the resolved_to fields to disambiguate. Accepts optional file/language filters. If the index for root does not exist yet it is built automatically.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNorestrict to call sites in this file
nameYescaller function name
rootNoindex root to query; required when several indexes exist
limitNomax results returned (default 50, hard max 200)
offsetNoskip the first N results before applying limit
languageNorestrict to one language

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does it well: it discloses the heuristic/name-based nature, confidence tiers, grouping of same-named callees with `resolved_to` for disambiguation, and the side effect of automatically building a missing index. These are non-obvious traits an agent needs before calling.

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?

The description is two dense sentences with no filler. It front-loads the core behavior, then adds the ambiguity caveat, filter options, and index auto-build behavior — every clause earns its place.

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?

The description covers output grouping, result fields, disambiguation, filters, and index auto-build — solid for a tool with no output schema. It does not state whether `limit`/`offset` apply to grouped callee names or individual call sites, nor the result ordering, which is a minor but real gap for pagination.

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 the baseline is 3. The description adds only light parameter context ('optional file/language filters', 'name-based'), which does not materially go beyond the existing schema descriptions for `name`, `file`, `language`, `root`, `limit`, and `offset`.

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 names the exact resource ('call sites inside a function's body'), the operation ('grouped per callee name'), and the direction of the query. 'Callee' and 'called by a function' make it clear this returns outgoing calls, distinguishing it from inverse siblings like `callers` and `find_references`.

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 gives clear context — inspect call sites inside a named function's body — and mentions optional file/language filters. However, it never explicitly says when to prefer this over sibling tools such as `callers`, `find_references`, or `list_definitions`; the contrast is only implied by the word 'callee'.

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

callersFind call sites of a functionA

Heuristic (name-based) call sites of a function in the indexed workspace: each hit gives file, line, language, enclosing caller function and receiver object, plus a confidence tier (exact when the receiver's declared type or an import resolves the callee, likely for same-dir/unique names, name as fallback). Same-named methods of different classes are mixed in one result; filter by resolved_to for a precise call graph. Accepts optional file/language filters. If the index for root does not exist yet it is built automatically.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNorestrict to call sites in this file
nameYescallee function name
rootNoindex root to query; required when several indexes exist
limitNomax results returned (default 50, hard max 200)
offsetNoskip the first N results before applying limit
languageNorestrict to one language

TDQS

A4.4/5.0
Behavior5/5

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

No annotations are present, so the description carries the full burden, and it delivers thoroughly. It discloses heuristic matching, the exact/likely/name confidence logic, that same-named methods are mixed, and that index creation happens automatically.

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?

Four dense sentences, each with a distinct job: core behavior, return fields and confidence, caveat about mixed methods, and filter/index behavior. The most important trait is front-loaded and there is no 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?

With no output schema, it describes what each hit contains and how confidence is determined, covering the essential return semantics. It could clarify how resolved_to appears in results or provide an example, but overall it is quite complete.

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 the schema already documents all parameters. The description re-states file/language filtering and adds the resolved_to guidance, though resolved_to is not an input parameter, which introduces slight 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 verb and resource: finds call sites of a function by name in the indexed workspace. It also distinguishes itself by describing the heuristic nature, confidence tiers, and the mixing of same-named methods, making it clearly different from precise reference tools.

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: use for name-based/heuristic call discovery, and filter by resolved_to when a precise call graph is needed. It also removes an index prerequisite by noting that the index is built automatically if missing, though it does not explicitly name sibling alternatives.

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

delete_indexDelete a workspace indexA

Drop a workspace symbol index built by index_workspace: removes it from the current session and deletes its persisted cache files (SQLite db / JSON) so the next index_workspace rebuilds from scratch. Omit root when exactly one index exists; with several indexes you must pass root. Non-destructive to source files — only cache is removed.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootNoindex root to delete; required when several indexes exist

TDQS

A4.2/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It clearly discloses that the tool removes the index from the current session, deletes persisted cache files (SQLite db / JSON), forces a rebuild from scratch, and leaves source files untouched. This precisely defines the destruction scope and side effects.

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 focused sentences. The first front-loads the action and its consequences; the second covers parameter usage and a safety caveat. There is no filler or repeated schema content.

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 one-parameter delete operation with no annotations or output schema, the description covers purpose, parameter behavior, side effects, and safety. It does not mention error handling for unknown roots or the effect on index_status, but these are minor gaps for a tool of this simplicity.

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 the baseline is 3. The description adds an explicit 'omit root when exactly one index exists' rule and reinforces the several-indexes requirement, but this is largely a restatement of the schema's 'required when several indexes exist'. The extra guidance is marginal but not redundant.

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 states a specific verb 'Drop' and a precise resource: 'a workspace symbol index built by index_workspace'. It clarifies what is removed (session index and persisted cache files) and differentiates itself from the sibling index_workspace by describing the rebuild cycle.

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 conditional guidance for the root parameter ('Omit root when exactly one index exists; with several indexes you must pass root') and clarifies non-destructive scope, but it does not explicitly name alternative tools or state when to prefer this over other index-related operations. The usage context is implied rather than fully explicit.

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

find_referencesFind identifier occurrencesA

Occurrences of an identifier across the indexed workspace, marking definition sites. References are classified with confidence tiers: exact (import-resolved or local), likely (same-dir or unique name), name (fallback). If the index for root does not exist yet it is built automatically (first call may be slow).

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNorestrict results to this file (scope filter for same-named definitions)
nameYesidentifier name to find
rootNoindex root to query; required when several indexes exist
limitNomax results returned (default 50, hard max 200)
offsetNoskip the first N results before applying limit

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral transparency burden. It usefully discloses the confidence-tier classification (exact, likely, name) and the side effect of automatic index building with a potentially slow first call. However, it does not state whether the operation is read-only, what the response structure looks like, or any other invocation side effects. The disclosed behaviors are helpful but incomplete.

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?

The description is compact and front-loaded: it states the core function first, then the classification behavior, then the indexing caveat. Every sentence contributes meaningful information without redundancy. It is appropriately sized for the tool's complexity.

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 description gives a solid mental model of what the tool does and how references are classified, but because there is no output schema and no annotations, the return format and exact result semantics are left unspecified. It lacks guidance on result ordering, how definition sites are marked, or how confidence tiers are represented. The description is adequate for a basic call but not fully complete for a tool with five parameters and no structured output documentation.

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 the description does not need to restate parameter meanings. The description adds context about indexing and confidence tiers but does not explain how individual parameters like limit, offset, or file affect behavior beyond their schema descriptions. This matches the baseline for fully covered schema parameters.

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 clearly specifies the operation: returning occurrences of an identifier across the indexed workspace while marking definition sites. It distinguishes itself from definition-focused siblings by emphasizing references and definition marking, though it does not explicitly name alternative tools. The title reinforces the action with 'Find identifier occurrences'.

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 context: use this when you need all occurrences of an identifier in the indexed workspace, including definition sites. It provides some operational guidance by noting that a missing index is built automatically on first call, but it does not explicitly contrast with siblings like go_to_definition, callers, or ast_search. No when-not-to-use or alternative-routing guidance is given.

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

get_node_typesList grammar node typesA

List named node types, anonymous tokens and field names for a language's grammar — use it to write correct ast_search query patterns without trial and error.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNofile path (alternative to language)
languageNolanguage to inspect

TDQS

A4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It implicitly signals a read-only operation through the verb 'List' and tells the agent what will be returned, but it does not explicitly disclose side-effect profile, return format, or any prerequisites around file versus language selection.

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?

The description is a single focused sentence that front-loads the resource being listed and adds a practical usage note. Every clause earns its place; there is no 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 simple read-only listing tool with two well-described optional parameters and no output schema, the description conveys the purpose, the returned content, and the primary usage context. It lacks explicit return formatting details, but the schema already explains the parameter alternatives.

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%, with both 'file' and 'language' already described in the input schema. The description itself adds no parameter-level detail, so the baseline 3 applies.

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 names a specific resource — 'named node types, anonymous tokens and field names' — with a clear verb, 'List'. The clause about writing 'correct ast_search query patterns' ties it to a concrete use case and differentiates it from the sibling ast_search tool.

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?

The description gives explicit context: use this tool before ast_search to avoid trial and error. It does not explicitly state when not to use it or name alternative tools, so it falls just short of full exclusion guidance.

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

go_to_definitionFind definitions by nameA

Definition sites of a name across the indexed workspace, nearest to the optional file first. If the index for root does not exist yet it is built automatically (first call may be slow).

ParametersJSON Schema
NameRequiredDescriptionDefault
fileNoreference file for proximity ranking
nameYesdefinition name
rootNoindex root to query; required when several indexes exist
limitNomax definitions returned (default 50, hard max 200)
offsetNoskip the first N definitions before applying limit

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden, and it deliberately disloses the key side effect: 'If the index for root does not exist yet it is built automatically (first all may be slow).' It also reveals proximity ordering behavior. It stops short of describing return shape or failure modes, but the most consequential behavior is transparent.

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: the first front-loads purpose and scope, the second adds the critical performance caveat. Every word earns its place; no fluff, no repetition of schema content.

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 5-parameter tool with no output schema and no annotations, the description covers scope, ordering, and the auto-index side effect, and the schema fully documents all parameters. It lacks an explicit statement of the return format and no-match or multi-index error cases, but the go-to-definition mental model is well supported.

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% so the baseline is 3, and the description adds value beyond the schema: it ties the auto-index-build behavior to the root parameter and clarifies the ranking semantics of file ('nearest ... first'), reinforcing the schema's 'reference file for proximity ranking' with concrete behavior.

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 states a specific operation — locating 'definition sites of a name across the indexed workspace' — with a clear scope and ordering rule. This distinguishes it from read_definition (which reads content), find_references (which finds usages), and list_definitions (which lists without a name filter).

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 context: proximity ranking via 'nearest to the optional file first' and an index-build caveat. However, with 14 siblings including closely related tools like read_definition, find_references, and ast_search, it never explicitly says when to choose this tool over an alternative or when not to use it.

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

index_statusReport index statusA

Report current workspace index state: root, version, totals, watcher active, pending dirty paths. Without root, reports the most recently built index plus all available roots.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootNoindex root to report; required when several indexes exist

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It clearly specifies what is reported and the fallback behavior when no root is supplied, which is valuable beyond the title. It doesn't explicitly state read-only behavior, but 'Report' implies a non-mutating operation.

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?

The description is two sentences with no wasted words. It front-loads the core purpose, then efficiently covers the optional-parameter fallback behavior.

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

Completeness5/5

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

For a simple status tool with one optional parameter and no output schema, the description is complete. It names the reported fields, covers the empty-parameter case, and gives enough context for an agent to invoke it 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 description coverage is 100%, so the baseline is 3. The description adds extra meaning beyond the schema by explaining what happens when root is omitted: the most recently built index plus all available roots are reported. This is genuinely useful semantic context.

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 uses a specific verb ('Report') with a clear resource ('current workspace index state') and enumerates concrete contents: root, version, totals, watcher active, pending dirty paths. This distinguishes it from sibling tools like index_workspace and delete_index.

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 when to use the tool by naming the state-report scope, but it does not explicitly state when to prefer this over alternatives or when not to use it. The 'Without root' clause gives conditional usage guidance for the parameter, not tool-vs-alternative selection.

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

index_workspaceIndex workspace symbolsA

Parse all supported source files under a directory into a persisted symbol index (definitions + identifier occurrences + call sites), backed by SQLite when available (JSON fallback). Run once before find_references / go_to_definition. Indexes are kept per root: indexing a new root adds a second index instead of replacing the existing one.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootYesworkspace root directory
maxFilesNocap on files to index (default 20000 with SQLite store, 1500 with JSON fallback; hard max 100000 / 5000)

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden. It discloses persistence, SQLite versus JSON fallback, and the per-root additive behavior rather than replacement. It could also mention cost or idempotency, but what it says is genuinely informative.

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?

Three sentences, each earning its place: what the tool does, when to run it, and the important per-root indexing caveat. No filler or repetition of the title.

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 only two parameters, full schema coverage, and no output schema, the description provides sufficient context for correct invocation: purpose, workflow placement, storage behavior, and indexing granularity. A return-value note would improve completeness but is not essential for this side-effectful tool.

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 coverage is 100%, so both root and maxFiles are already documented. The description adds only a modest clarification that root is the source directory being indexed; it does not meaningfully extend parameter understanding beyond 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 clearly states a specific action and resource: parsing supported source files into a persisted symbol index. It also names the index contents (definitions, identifier occurrences, call sites), making it distinct from the read/search siblings listed.

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?

It explicitly says to run the tool once before find_references / go_to_definition, which provides clear workflow context. It does not enumerate alternatives or conditions when not to use it, but the usage context is strong enough for an agent to select it appropriately.

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

list_definitionsList definitions in a fileA

List definitions (classes, functions, methods, fields, structs...) in a source file with name, kind and line ranges. Structural alternative to reading the whole file.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesfile path
languageNooverride language inference

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral disclosure burden. It discloses the output fields (name, kind, line ranges) and frames it as non-whole-file reading, but it does not mention language inference behavior, possible limitations, error cases, or how the tool determines definitions. This is adequate but not richly transparent.

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?

The description is two sentences, front-loading the core function and output details before adding the structural-alternative context. Every phrase earns its place, with no filler or repetition.

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?

For a simple list tool, the description is mostly complete: it states the resource, output shape, and purpose. However, it lacks context about language inference/override behavior, unsupported languages, and return format nuances. With no output schema, a bit more detail about how the tool behaves would make it fully complete.

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 the parameters 'file' and 'language' are already documented in the schema. The description adds no extra parameter-level detail, such as the meaning of the language override or its enum values, which keeps it at the baseline of 3.

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 uses a specific verb ('List') and identifies exactly what is returned: definitions in a source file with name, kind, and line ranges. It also gives concrete examples (classes, functions, methods) and distinguishes itself as a structural alternative to reading the whole file, separating it from content-reading tools.

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?

The description provides a clear usage context: use this tool to get a structural overview instead of reading the entire file. It does not explicitly enumerate exclusions or compare against sibling tools like ast_search or read_definition, but the intended scenario is reasonably clear.

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

list_presetsList audit query presetsB

List built-in and user-provided audit query presets per language (eval/exec, subprocess shell, innerHTML, System.exit, os/exec...).

ParametersJSON Schema
NameRequiredDescriptionDefault
languageNorestrict to one language

TDQS

B3.3/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 the full burden of behavioral disclosure. It only says 'List', implying a read-only operation, and describes the scope of returned presets, but it does not disclose what happens when language is omitted, how results are structured, or whether any side effects exist.

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?

The description is a single, focused sentence that front-loads the action and resource. It includes relevant examples in parentheses without wasting words.

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 tool is simple with one optional parameter, but there is no output schema and no annotations. The description does not state the default behavior when language is omitted or what the returned list contains beyond 'presets', leaving some ambiguity for an agent.

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 coverage is 100% and the only parameter has an enum plus a clear description ('restrict to one language'). The description's 'per language' phrasing adds little beyond the schema, so the baseline of 3 is appropriate.

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 states a specific verb ('List') and a specific resource ('audit query presets'), and adds useful scope: built-in versus user-provided, and per-language. This clearly distinguishes it from the sibling preset_search, which implies searching/filtering rather than listing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the language restriction but gives no explicit guidance about when to use this tool versus alternatives like preset_search or list_definitions. There are no when-to-use, when-not-to-use, or alternative-selection cues.

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

read_definitionRead one definitionA

Read the source code of one definition (method/class/function...) by exact name from a source file. Overloads and same-named definitions are all returned with line numbers.

ParametersJSON Schema
NameRequiredDescriptionDefault
fileYesfile path
nameYesexact definition name
languageNooverride language inference
maxLinesNocap on lines returned per definition (default 200, hard max 1000); longer bodies are truncated

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden. It discloses the core behavior: exact-name lookup, returning all overloads/same-named definitions, and including line numbers. It does not cover error cases or return structure, but for a read operation the described behavior is substantial.

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 information-dense sentences with no filler. The key constraints (exact name, source file, all overloads returned, line numbers) are front-loaded.

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 simple read tool with four well-documented parameters, the description covers what the tool returns and its matching behavior. It lacks an explicit note on behavior when the name is not found or the file is missing, but no output schema exists and the core contract is clear.

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 coverage is 100%, so the parameters are already documented in the schema. The description reinforces file and exact-name lookup but does not add significant semantics beyond that baseline.

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 verb ('Read'), a specific resource ('source code of one definition... from a source file'), and the exact-name constraint. This distinguishes it from siblings like list_definitions and go_to_definition because it returns code content rather than listings or navigation.

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?

The description clearly signals it is for retrieving a known definition by its exact name from a file, which is actionable context. It does not explicitly name alternatives or give when-not-to-use conditions, but the exact-name requirement implies the boundary.

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

resolution_statsMeasure cross-file resolution coverageA

Aggregate resolution statistics over the indexed workspace: share of call sites resolved at each confidence tier (exact/likely/name), how import names resolve, and how many names are defined in several files. Use it to measure, not assert, how well cross-file navigation works on a given codebase.

ParametersJSON Schema
NameRequiredDescriptionDefault
rootNoindex root to measure; required when several indexes exist

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, so the description carries the behavioral disclosure burden. It communicates a read-only analytical purpose ('measure, not assert') and details what statistics are aggregated: confidence tiers, import resolution, and multi-file name definitions. It does not discuss error behavior or indexing prerequisites explicitly, but the 'over the indexed workspace' phrasing implies the required state.

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?

The description is two sentences with no redundancy. The core action and output categories are front-loaded, and the final sentence adds concise usage guidance without padding.

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 tool with one optional parameter and no output schema, the description covers the main invocation context and the shape of the output metrics. It could be slightly more explicit about prerequisites such as needing a previously indexed workspace, but that is reasonably inferred from 'indexed workspace'.

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 the single 'root' parameter is already fully documented in the schema. The description does not add extra meaning about the parameter, but the baseline of 3 applies because the schema carries the burden adequately.

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 uses a specific verb ('Aggregate') and identifies a precise resource ('resolution statistics over the indexed workspace'). It enumerates the specific kinds of metrics produced, which clearly differentiates it from sibling tools that operate on individual definitions or references.

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?

The description explicitly frames the tool as a measurement tool ('Use it to measure, not assert') and connects it to assessing cross-file navigation, which gives clear context for when to invoke it. It does not name alternative tools or explain when not to use it, but the aggregate-versus-individual distinction is strongly implied.

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

TDQS

A3.9/5.0
Disambiguation4/5

Most tools target clearly distinct operations (read vs list vs search vs index), and descriptions include enough detail to separate them. Minor overlap exists between find_references/callers and go_to_definition/read_definition, but the descriptions identify different granularities and index dependencies.

Naming Consistency5/5

All tool names use consistent snake_case with a clear verb_noun or noun form (list_definitions, index_workspace, preset_search, callers, callees). No mixed conventions or vague generic verbs appear.

Tool Count5/5

15 tools is well within the appropriate range for a code-analysis server: file-level reading/querying, workspace indexing, reference resolution, call-graph helpers, and presets each have a clear place. The count feels deliberate rather than padded.

Completeness4/5

The surface covers the domain well: per-file definitions, AST queries, presets, indexing lifecycle, reference/definition lookup, and call-graph analysis. A minor gap is the lack of workspace-wide AST/search operations and no listing of files/symbols across the workspace, but agents can work around those with existing tools.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables LLM agents to query a codebase's structural knowledge (symbols, imports, call graphs, etc.) via MCP, reducing tokens and improving correctness compared to raw file access.
    26
    6
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI coding agents to efficiently explore codebases by providing structural outlines, module digests, symbol bodies, and AST-aware grep via MCP.
    4
    17
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for semantic codebase navigation that builds an AST index of symbols, imports, and exports, providing AI agents with tools to search, explore, and understand code.
    MIT

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/zhaoxingxing06/kimi-tree-lens'

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