Expand description
MCP tool handlers for the tree-sitter code knowledge graph.
These map parsed code symbols (see crate::code) onto a knowledge graph
so the regular search/traversal primitives work on code, and expose
code-focused tools: code_index, code_watch, code_outline,
code_search, code_get_symbol.
Symbols are stored as entities named {relpath}::{symbol} with type
code:<kind>; metadata (file, line range, signature, doc) lives in
observations. Edges: defines (file→symbol), calls/references
(caller→callee, resolved only when the callee name is unambiguous).
Multiple independent projects are supported by physical partitioning:
each code_index/code_watch call takes an optional project identifier
(default "default") that selects a dedicated SQLite database, opened via
crate::code_registry. Projects therefore never collide and are fully
isolated from the main memory graph and from the knowledge-graph tools.
Functions§
- handle_
code_ get_ symbol - handle_
code_ index - handle_
code_ outline - handle_
code_ search - handle_
code_ watch - Start watching a project directory for file changes and re-index on modification. Spawns a background thread that monitors the directory tree with a debounced file-watcher. The initial index runs synchronously before returning.