Skip to main content
Glama
ARQAWA

code_nav MCP

by ARQAWA

code_nav.coverage

Read-only

Show git-visible file coverage to identify tracked files in the repository.

Instructions

Show git-visible file coverage; no semantic index exists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the code_nav.coverage tool. Gets repo root, loads config, lists candidate files (via git ls-files or glob), counts files by extension, and returns coverage metadata including repo root, file counts, extensions, skipped info, and warnings.
    export async function coverage(cwd = process.cwd()) {
      const repo = await getRepoRoot(cwd);
      const loaded = await loadConfig(repo.repoRoot);
      const listed = await listCandidateFiles(repo.repoRoot, repo.isGitRepo, loaded.config);
      const extensions: Record<string, number> = {};
      for (const file of listed.files) {
        const ext = file.extension || "[none]";
        extensions[ext] = (extensions[ext] ?? 0) + 1;
      }
      return {
        repo_root: repo.repoRoot,
        mode: "no-semantic",
        tracked_and_untracked_files: listed.files.length,
        extensions: Object.fromEntries(Object.entries(extensions).sort()),
        skipped: listed.skipped,
        code_navrc: loaded.path,
        warnings: [...repo.warnings, ...loaded.warnings, ...listed.warnings],
      };
    }
  • MCP tool registration for code_nav.coverage with no input schema (empty object), marking it as read-only.
    server.registerTool(
      "code_nav.coverage",
      {
        description: "Show git-visible file coverage; no semantic index exists.",
        inputSchema: {},
        annotations: { readOnlyHint: true, openWorldHint: false },
      },
      async () => mcpJson(await coverage()),
    );
  • Helper function that lists candidate files by running git ls-files (for git repos) or fast-glob fallback. Handles extra_include/extra_exclude, marks binary/skipped files.
    export async function listCandidateFiles(
      repoRoot: string,
      isGitRepo: boolean,
      config: CodeNavConfig,
    ): Promise<FileListResult> {
      const warnings: string[] = [];
      let paths: string[] = [];
      if (isGitRepo) {
        const result = await runCommand(
          "git",
          ["ls-files", "-co", "--exclude-standard", "-z"],
          { cwd: repoRoot, maxBuffer: 50 * 1024 * 1024 },
        );
        if (result.ok) {
          paths = result.stdout.split("\0").filter(Boolean);
        } else {
          warnings.push(`git ls-files failed: ${result.stderr}`);
        }
      }
      if (paths.length === 0) {
        paths = await fg(["**/*"], {
          cwd: repoRoot,
          onlyFiles: true,
          dot: true,
          ignore: [".git/**", "node_modules/**", "dist/**", "coverage/**"],
        });
        if (!isGitRepo) warnings.push("used fast-glob fallback because repo is not git");
      }
    
      const includeSet = new Set(paths.map(normalizeRel));
      for (const include of config.extra_include) {
        const matches = await fg(include, { cwd: repoRoot, onlyFiles: true, dot: true });
        for (const match of matches) includeSet.add(normalizeRel(match));
      }
    
      const files: CandidateFile[] = [];
      const skipped = { binary: 0, too_large: 0 };
      for (const relPath of [...includeSet].sort()) {
        if (matchesAny(relPath, config.extra_exclude)) continue;
        if (config.markdown === "off" && isMarkdown(relPath)) continue;
        const absPath = path.join(repoRoot, relPath);
        let stat;
        try {
          stat = await fs.stat(absPath);
        } catch {
          continue;
        }
        if (!stat.isFile()) continue;
        const binary = await isBinaryFile(absPath);
        const tooLarge = stat.size > config.max_file_bytes;
        if (binary) skipped.binary += 1;
        if (tooLarge) skipped.too_large += 1;
        if (binary || tooLarge) continue;
        files.push({
          path: normalizeRel(relPath),
          absPath,
          size: stat.size,
          extension: path.extname(relPath),
          binary,
          tooLarge,
        });
      }
      return { files, skipped, warnings };
    }
  • src/cli.ts:28-30 (registration)
    CLI registration of the coverage command, allowing direct invocation via 'code-nav-mcp coverage'.
    if (command === "coverage") {
      console.log(jsonText(await coverage()));
      return;
  • Helper that resolves the git repo root, used by the coverage handler.
    export async function getRepoRoot(cwd = process.cwd()): Promise<RepoInfo> {
      const resolvedCwd = path.resolve(cwd);
      const result = await runCommand("git", ["rev-parse", "--show-toplevel"], {
        cwd: resolvedCwd,
      });
      if (result.ok && result.stdout.trim()) {
        return {
          cwd: resolvedCwd,
          repoRoot: path.resolve(result.stdout.trim()),
          isGitRepo: true,
          warnings: [],
        };
      }
      return {
        cwd: resolvedCwd,
        repoRoot: resolvedCwd,
        isGitRepo: false,
        warnings: ["not a git repo; using cwd as repo_root"],
      };
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, establishing safety. The description adds the behavioral note 'no semantic index exists,' which is useful for setting expectations but does not detail return format or 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?

The description is a single, focused sentence with no extraneous words. It front-loades key information and 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?

For a parameterless tool with good annotations, the description covers the essential purpose and a key limitation. It could elaborate on what 'coverage' means or what 'git-visible' implies, but it is adequate for 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?

The tool has zero parameters and schema coverage is 100%, so the description need not explain parameters. The baseline for no parameters is 4; the description adds nothing extra but is adequate.

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 the tool's purpose: 'Show git-visible file coverage'. This is a specific verb+resource combination that distinguishes it from sibling tools like code_nav.exact_search or code_nav.find_file.

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 provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, expected usage contexts, or exclusions, leaving the agent to infer the tool's role from context.

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

Install Server

Other Tools

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/ARQAWA/code-nav-mcp'

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