Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
CODENAV_MCP_WORKSPACENoPins the project root (never overridden). Default: unset: follows the client's MCP roots when they name a worktree of the same git repository, else CLAUDE_PROJECT_DIR, else the working directory.
CODENAV_MCP_SOURCE_ROOTNoDirectory scanned for `implementations` candidates and used to derive dotted import paths (e.g. `src`). Default: whole workspace.
CODENAV_MCP_EXTRA_SOURCE_ROOTSNoComma-separated directories (e.g. `tests`) that `implementations` also scans; matches (test doubles) are listed under a separate heading. Default: none.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Code navigation for this Python codebase, backed by ty (Astral's type checker/language server). Prefer this over grepping for symbol definitions/usages: it resolves through type inference (imports, dependency-injected parameters, dataclass fields, etc.), not just text matching. Python files only (.py/.pyi) — other extensions are rejected. Start with symbol_info (what is X, where is it used) or outline (what's in this file) rather than chaining search_symbol → hover → definition → references by hand; drop to the position tools (hover/definition/references) once you have a specific line to inspect. To change code, prefer the write tools over hand edits where one fits: edit (text), edit_symbol (replace/insert/delete a definition by name), rename_symbol, change_signature, move (a symbol or a module), quick_fix. They type-check the edit before writing and write it when it adds no errors (max_new_errors=0; apply=false only previews); verify_changes shows what the working tree broke, undo_edit reverts. To read or change several files or symbols, send them as one batch(calls=[{tool, args}, ...]) instead of many separate calls. Positions are 1-indexed. column is a UTF-16 character offset on the line (not a visual/display column): a leading tab counts as one character, so after a single tab the next character starts at column 2.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
workspaceA

Which directory is codenav navigating, and why?

Also shows the source root, the write mode, the ty command and any configuration warnings. Use when results look like they come from the wrong checkout/worktree.

hoverA

Get type/documentation info for the symbol at a position.

line and column are 1-indexed. column is a UTF-16 character offset on the line (not a visual/display column): a leading tab counts as one character. Put the position on the symbol's name: on a def/class keyword there is no hover. Paths outside the workspace are refused before the file is read.

definitionA

Go to the definition of the symbol at a position.

line and column are 1-indexed. column is a UTF-16 character offset on the line (not a visual/display column): a leading tab counts as one character.

Resolves through ty's type inference, so this works even when the call site only has a typed parameter/attribute (e.g. services.some_method() where services: AppServices is a constructor argument), not just direct references to a name in scope. A module with a .pyi stub gives the stub first and the .py implementation as an Also: line. Library locations show as <stdlib>/... or <site-packages>/....

referencesA

Find all usages of the symbol at a position across the workspace.

line and column are 1-indexed. column is a UTF-16 character offset on the line (not a visual/display column): a leading tab counts as one character.

The first line is the exact total (N reference(s) in M file(s):). limit (default 200) caps how many hits are listed; production code is listed before tests. Hits in files outside the workspace are not shown.

search_symbolA

Search the whole workspace for a symbol by name (class, function, method, etc.).

Use this to find a symbol's file/position first, then pass that position to definition/references/hover for precise, type-resolved navigation. Returned positions point at the identifier name (not the class/def keyword) and use the same character-offset column convention as the other tools. Results include a SymbolKind label and are capped; hits in files outside the workspace, and in nested git checkouts below it (a vendored repo, a linked worktree), are not shown. name is accepted as an alias for query. Narrow broad queries with kind (SymbolKind labels, comma-separated: class, function,method, interface, ...) and path. path is a workspace-relative prefix matched against the start of each file's path (src/ matches src/..., but p also matches plugins/...); a value with *, ? or [ is a glob matched against the whole relative path (src/**/*.py; * also matches /). An absolute path inside the workspace is accepted. Production code ranks before tests. Loose fuzzy hits whose names don't contain the query are summarised as a count; pass fuzzy=true to list them with a fuzzy marker. A dotted query (Cart.total, pkg.mod.func) finds the name after the last dot whose owner is the part before it (its class, or its module path).

diagnosticsA

Get ty's type-check diagnostics (errors/warnings) for a single file.

Each line starts with the file's workspace-relative path, then line:column.

symbol_infoA

What is X and where is it used? Example: symbol_info(name="UserService.create_user").

One-call summary for a name: header, hover text, definition, and references grouped by file — the usual first lookup instead of chaining search_symbol → hover → definition → references by hand.

name is a symbol name, or a dotted Class.method to resolve a specific method when the plain name is ambiguous. A dotted module path (pkg.mod.func) resolves to the function in that module. Pass file_path (relative to the workspace root) to disambiguate when several symbols share a name elsewhere in the workspace; if it's still ambiguous, the candidates are listed back so you can retry with a narrower name or file_path. Local variables and parameters are not indexed, so they are not found by name. query is accepted as an alias for name; passing both with different values is refused.

outlineA

What's in this file? Example: outline(file_path="src/app/services.py").

Indented outline (classes, methods, functions, with line numbers) of a Python file, so you can navigate a large file without reading it in full. depth=1 lists only the top-level definitions. A file with a syntax error gets a warning line first (the outline may be incomplete); a file that contains a NUL byte is refused. Follow up with hover/definition/references at a listed line, or symbol_info by name.

callersA

Who calls this function? Example: callers(name="create_user").

Narrower than references, since it leaves out imports and type-only usages and only lists actual call sites.

name resolves the same way as symbol_info (dotted Class.method accepted; pass file_path to disambiguate a common name). query is accepted as an alias for name. The first line is the exact count of callers; limit (default 200) caps how many are listed. A function that is only used as a value (passed or stored, never called) gets a note saying so. For a method of a class that has subclasses the reply says overriding methods are not included. Callers in files outside the workspace are not shown.

implementationsA

Find concrete classes that structurally satisfy a Protocol port.

Many hexagonal codebases define ports as Protocols that adapters never subclass explicitly, so ty's own implementation/typeHierarchy return nothing for them. This scans classes under SOURCE_ROOT (the whole workspace by default; see CODENAV_MCP_SOURCE_ROOT) whose method names cover the protocol's, then verifies each candidate with ty's real type checker via an in-memory probe file (never written to disk) — so a result means "assignable", not just "same method names". port_name must itself resolve to a Protocol class; other classes' subclasses are better found with references/symbol_info. name and query are accepted as aliases for port_name. file_path narrows the port lookup to one file when the name exists in several. Members inherited from same-workspace base classes, and fields/properties declared by the port, count when matching names. Directories listed in CODENAV_MCP_EXTRA_SOURCE_ROOTS (e.g. tests) are scanned too; their matches (test doubles) are listed under a separate heading.

rename_symbolA

Rename a symbol everywhere it is used, type-checking the result before writing it.

Example: rename_symbol(name="UserService.create_user", new_name="register_user"). Give name (dotted Class.method accepted; file_path narrows it) or file_path + line + column (1-indexed). Use parameter="x" with a function's name to rename one of its parameters (keyword arguments at call sites follow).

Built on ty's rename (imports, aliases, keyword arguments) plus what ty misses: with linked=true (default) overriding methods in subclasses, super().name() calls, and Protocol members together with the classes that satisfy them are renamed as one, since renaming only one side would silently break the override or the conformance. The result lists every extra member it included, and the places still using the old name that the type checker could not link (untyped attribute accesses, strings, comments, docs).

Writing: apply=true (default) writes when the new errors are within max_new_errors (default 0); otherwise nothing is written and you get a preview id for apply_edit. apply=false always previews. undo_edit reverts.

verify_changesA

What did the edits since a git revision break? Compares ty diagnostics now against since (default HEAD).

Run it after editing with any tool (your own Edit/Write included) to see the type errors the working tree has gained or lost relative to the last commit: the changed Python files and the files importing them are checked with the committed versions of the changed files substituted in for the "before" side. Read-only. A changed pyproject.toml, ty.toml or .ty.toml changes the rules for every file: then the whole project is checked and every current diagnostic is listed, because the old configuration cannot be re-checked.

apply_editA

Write a previewed edit (the id comes from a write tool's preview). The applied edit keeps that id, so undo_edit(id) reverts it. Fails if any file changed since the preview.

undo_editA

Revert an edit applied by the write tools (the latest one by default). The undo history keeps the last 20 edits of this server session; older ones, and ids that were already undone, cannot be reverted.

Refuses when any of its files was changed after the edit, so later work is never overwritten. An edit blocked by a newer one names that edit, which must be undone first.

quick_fixA

Apply ty's own fixes for a file's diagnostics (today: add the missing import). Example: quick_fix(file_path="src/app.py").

Looks at the file's diagnostics (narrow with line or a rule code such as unresolved-reference), asks ty for the quick fixes, and applies them. Imports are placed after the docstring and the existing imports, merged into an existing from x import ... where there is one. When a diagnostic has several equally good fixes (two modules that both export Path) nothing is applied: the options are listed, and you repeat the call with choice set to part of the title you want (choice="pathlib") or a 1-based choice number. Fixes that only silence the error (# ty: ignore) are skipped unless allow_suppress=true.

change_signatureA

Add, remove or reorder a function's parameters and update every call site. Example: change_signature(name="send_mail", add=[{"name": "retries", "annotation": "int", "default": "3"}]).

name is a function, a method (Class.method) or a class (its __init__).

  • add: list of {"name", "annotation"?, "default"?, "value"?, "position"?, "keyword_only"?}. default is written in the definition and callers need not change; value is inserted at every call site as name=value (give both for a required-at-call parameter with a default). position is a 0-based index among the parameters (self/cls not counted); the default is the end. One of default/value is required.

  • remove: parameter names; the matching argument is dropped at each call.

  • reorder: the complete new order of the named parameters. Positional arguments are rearranged, and turned into keywords where a position would no longer line up.

Call sites come from the type checker's references, so calls through injected dependencies and typed attributes are found, not just textual matches. Overriding methods get the same change (include_overrides). Calls using *args/**kwargs and places where the function is passed around as a value are listed as manual work rather than guessed at. Unresolved alias calls, calls with comments, and effectful argument reorderings are also listed for manual review. Decorators and docstrings mentioning removed parameters produce notes. Writes when new errors stay within max_new_errors (default 0), else previews with an id for apply_edit; apply=false always previews.

editA

Edit text in a Python file, type-checked: edit(file_path="src/app.py", old_string="x = 1", new_string="x = 2").

Use this for changes that are not a whole definition (a few lines, an import, a module-level statement) or for rewriting a whole file (new_text). To replace, add or delete a function/method/class by name use edit_symbol.

Give either old_string -> new_string (old_string must match exactly once unless replace_all=true; the reply gives the matching lines and the replacement count) or the complete new_text (also creates a new file), never both. Each text is at most 1,000,000 characters. The text must be valid Python; new lines take the file's line endings (CRLF stays CRLF). Writes when the new errors in the file and in the files that import it stay within max_new_errors (default 0, null = no limit); otherwise nothing is written and the result lists the errors plus an id for apply_edit. apply=false always previews. undo_edit reverts.

edit_symbolA

Replace, add or delete a function, method or class by name. Examples: edit_symbol(action="replace", name="Cart.total", source="def total(self): ..."), edit_symbol(action="insert", file_path="src/utils.py", name="parse", source="def helper(): ..."), edit_symbol(action="delete", name="legacy_parse").

  • action="replace": name (the symbol; dotted Class.method ok) and source (the complete new definition, decorators included: anything not given is dropped and the result says so). Re-indented to the old one's place, file style kept. A changed signature shows up as errors at call sites; to change a signature and its callers together use change_signature.

  • action="insert": source (the new definition) and file_path. position says where, relative to name: "after" (default when name is given) / "before" a symbol defined in the file (a method like Cart.total places it inside that class), "into" a class (appended to its body), or "end" of the file (default without name). PEP 8 blank lines, matching indentation. Refuses a name that already exists in that scope (use "replace").

  • action="delete": name only. Deletes only when nothing uses it, otherwise lists the users and writes nothing (force=true deletes anyway and shows what breaks). Imports that are the only remaining users are removed (prune_imports). Uses the type checker cannot see (strings, getattr, docs) are listed and the deletion is previewed. Comments directly above a definition are kept.

file_path narrows name when several symbols share it. imports (replace/insert) is a list of import statements the new code needs, added if missing. Writes when the new errors stay within max_new_errors (default 0, null = no limit); else previews with an id for apply_edit; apply=false always previews. undo_edit reverts.

moveA

Move a function/class to another file, or a whole module file, and fix every import. Examples: move(name="parse_date", to_file="src/app/dates.py") (one symbol), move(file_path="src/app/util.py", to_file="src/app/common/helpers.py") (the whole module).

With name: moves that module-level function or class (file_path narrows which one). The destination is created if missing. The code travels with the imports it needs (relative ones made absolute), imports only the moved code used are dropped from the old file, and if the old file still uses it, it imports it from the new place (keep_reexport=true always leaves that import so old from old import name keeps working). Every from old import name elsewhere is rewritten. A move that would create a module-level import cycle is refused unless allow_import_cycle=true. Importers the move cannot update (too many, unreadable, unparsable) are reported by name and held back unless apply=true and allow_large=true; uses through the old module (old.name) and strings are listed for you.

Without name: file_path is the module to move or rename (required); every from old import x, import old [as y] and from package import old is rewritten (a relative import stays relative when the module stays in its package, else it becomes absolute). Strings and docs naming the old path are listed.

Writes when the new errors stay within max_new_errors (default 0); else previews with an id for apply_edit; apply=false always previews. undo_edit reverts.

batchA

Run several codenav tool calls in ONE request (saves round-trips and tokens).

Example: batch(calls=[{"tool": "outline", "args": {"file_path": "src/a.py"}}, {"tool": "symbol_info", "args": {"name": "Cart.total"}}]). Works for reads and writes alike, e.g. two edits in different files: [{"tool": "edit", "args": {"file_path": "src/a.py", "old_string": "x = 1", "new_string": "x = 2"}}, {"tool": "edit_symbol", "args": {...}}].

Each call takes the same arguments as the tool called alone (args is that tool's parameter object) and behaves as if you had called it separately: calls run in order, so a later call sees what an earlier write changed, and every write is type-checked, previewed/applied and undoable on its own (see its own section for the edit id). The result has one numbered section per call, then a summary line.

stop_on_error: stop at the first call that fails or does not apply a write (the rest are skipped and listed). Default (null): stop when the batch contains a write, keep going when it only reads. Up to 25 calls; batch cannot be nested. A call cannot refer to an earlier call's result ("$1" is refused): make the calls independent.

Annotated as possibly destructive because a batch may contain write calls; a batch made only of read tools (outline, symbol_info, hover, ...) writes nothing.

Not atomic: calls that already ran stay applied (each has its own undo id). Line/column positions you computed before the batch may be stale after an earlier edit in it, so prefer name-based calls (symbol_info, edit_symbol, rename_symbol) after writes. A preview id is invalid once a later call changes the same file.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.9/5.0

Scored across 20 tools

Disambiguation4/5

The tools mostly have distinct scopes: positional navigation, name search, symbol summaries, usage analysis, diagnostics, and type-checked editing. Minor overlap remains between edit and edit_symbol, and between symbol_info/search_symbol/references, but the descriptions give clear guidance on when to use each.

Naming Consistency3/5

All names use lowercase snake_case, but the set mixes verb_noun forms (edit_symbol, rename_symbol, verify_changes), noun-only forms (hover, definition, references, callers), and noun_noun forms (symbol_info). It is readable, but there is no single predictable naming pattern across the 20 tools.

Tool Count4/5

20 tools is on the heavy side, but the server covers several coherent areas: navigation, diagnostics, refactoring, undo/preview, and batching. Most tools earn their place, though some aggregator/tool pairs could potentially be consolidated.

Completeness4/5

The surface is very complete for type-aware navigation and refactoring: search, outline, hover, definition, references, callers, implementations, diagnostics, edits, rename, signature changes, move, quick fix, undo, and verify. Minor gaps include no explicit read-file/list-files or textual-search tool, which may be expected from the client rather than this server.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues