code_nav.health
Verify repository detection and navigation dependency health. Quickly identifies issues with repo recognition and dependency integrity.
Instructions
Check repo detection and code_nav dependency health.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/health.ts:8-51 (handler)The 'health' function that executes the tool logic — checks repo detection, dependencies (git, fff, probe, ast-grep, rg, rtk), config, and collects warnings.
export async function health(cwd = process.cwd()) { const repo = await getRepoRoot(cwd); const config = await loadConfig(repo.repoRoot); const [git, probe, rg, rtk, astGrep, fff, gitGrep] = await Promise.all([ commandVersion("git", ["--version"]), commandVersion("probe", ["--version"]), commandVersion("rg", ["--version"]), rtkStatus(), detectAstGrep(), getFffStatus(repo.repoRoot), runCommand("git", ["grep", "--help"], { cwd: repo.repoRoot }), ]); const warnings = [ ...repo.warnings, ...config.warnings, ...(fff.warning ? [`fff: ${fff.warning}`] : []), ...(probe.ok ? [] : ["probe is not installed; extract_context will fallback"]), ...(astGrep.ok ? [] : ["ast-grep/sg is not installed; structural_search unavailable"]), ...(rg.ok ? [] : ["rg is not installed; exact_audit may use git grep"]), ...(rtk.ok ? [] : ["rtk is not installed; noisy-output helper unavailable"]), ]; return { ok: git.ok, repo_root: repo.repoRoot, dependencies: { git: { ok: git.ok, version: git.version }, git_grep: { ok: gitGrep.exitCode === 0 || gitGrep.exitCode === 129 }, fff: { ok: fff.mode === "node", mode: fff.mode }, probe: { ok: probe.ok, version: probe.version }, ast_grep: { ok: astGrep.ok, command: astGrep.command, version: astGrep.version, }, rg: { ok: rg.ok, version: rg.version }, rtk: { ok: rtk.ok, version: rtk.version }, }, config: { mode: "auto", code_navrc: config.path, }, warnings, }; } - src/mcp.ts:20-28 (registration)Registration of the 'code_nav.health' tool on the McpServer with input schema, description, and annotations.
server.registerTool( "code_nav.health", { description: "Check repo detection and code_nav dependency health.", inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: false }, }, async () => mcpJson(await health()), ); - src/mcp.ts:1-28 (helper)Imports the health function and the mcpJson helper used by the tool handler.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod/v4"; import { mcpJson } from "./core/json.js"; import { coverage } from "./tools/coverage.js"; import { exactAuditTool } from "./tools/exact-audit.js"; import { exactSearch } from "./tools/exact-search.js"; import { extractContextTool } from "./tools/extract-context.js"; import { findFile } from "./tools/find-file.js"; import { health } from "./tools/health.js"; import { search } from "./tools/search.js"; import { structuralSearchTool } from "./tools/structural-search.js"; export function createServer(): McpServer { const server = new McpServer({ name: "code_nav", version: "0.1.0", }); server.registerTool( "code_nav.health", { description: "Check repo detection and code_nav dependency health.", inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: false }, }, async () => mcpJson(await health()), );