Skip to content

MCP Tools Reference ​

ContextWeaver exposes 5 MCP tools. The design principle is: semantic retrieval first, structure browsing second.

ToolPurposeEmbedding cost
codebase-retrievalHybrid semantic + exact-match retrievalYes
list-filesList indexed file structureNo
find-referencesHeuristic symbol reference lookupNo
get-symbol-definitionHeuristic symbol definition lookupNo
statsIndex, search, and health statisticsNo

codebase-retrieval ​

The primary retrieval tool. Use it for questions like "how is this feature implemented?" or "where is this flow handled?".

Parameters:

ParameterTypeRequiredDescription
repo_pathstringYesAbsolute path to the repository root
information_requeststringYesNatural-language semantic goal
technical_termsstring[]NoExact symbols or terms to emphasize

Recommended usage:

json
{
  "repo_path": "/path/to/repo",
  "information_request": "Trace the login flow and error handling.",
  "technical_terms": ["LoginService", "AuthToken"]
}

list-files ​

Quickly inspect indexed file structure without calling the Embedding API.

Parameters:

ParameterTypeRequiredDescription
repo_pathstringYesAbsolute path to the repository root
globstringNoPath glob filter
languagestringNoLanguage filter
max_resultsnumberNoMaximum number of results

CLI mirror:

bash
contextweaver list-files --glob "src/**/*.ts" --language typescript --max-results 100

find-references ​

Find heuristic text references to a symbol over indexed chunks. This is not compiler-accurate navigation.

Parameters:

ParameterTypeRequiredDescription
repo_pathstringYesAbsolute path to the repository root
symbolstringYesExact symbol name
exclude_definitionbooleanNoExclude likely definition chunks
max_resultsnumberNoMaximum results, default 50

CLI mirror:

bash
contextweaver references SearchService --exclude-definition

get-symbol-definition ​

Find likely definition blocks for classes, functions, methods, and similar symbols.

Parameters:

ParameterTypeRequiredDescription
repo_pathstringYesAbsolute path to the repository root
symbolstringYesExact symbol name
hint_pathstringNoPreferred path to disambiguate same-name definitions
max_resultsnumberNoMaximum results, default 3

CLI mirror:

bash
contextweaver definition SearchService --hint-path src/search

stats ​

Returns index, search, and health statistics, including:

  • indexing counters
  • search behavior and cache hit rate
  • health and consistency diagnostics
  • migration state
  • pending_marks backlog
  • LanceDB row count and embedding dimensions

CLI mirror:

bash
contextweaver stats
contextweaver stats --json

Tool design guidance ​

When adding a new MCP tool, first classify it as:

  1. Semantic retrieval: may require Embedding/Rerank
  2. Structure browsing: should usually be zero API cost
  3. Diagnostics/statistics: should support machine-readable output when useful

See Extending MCP Tools for implementation steps.

Released under the MIT License.