Skip to content

MCP tools

The opencodehub MCP server registers 29 tools, imported and invoked from packages/mcp/src/server.ts. The number is taken live from buildServer() at startup.

Every per-repo tool accepts an optional repo argument (registry name) or repo_uri alias (Sourcegraph-style URI). See MCP overview for the resolution rules and the AMBIGUOUS_REPO envelope.

The agent-friendly machine-readable catalog (same content, JSON shape) is published at /tool-catalog.json so a coding agent can fetch the catalog directly.

The high-frequency tools. Most agent loops live here.

Use whenThe agent does not know what repos are indexed on the host. Always cheap.
Avoid whenYou already know the target repo — pass repo_uri directly.
Inputs— (no arguments)
Returns{ repos: [{ name, repo_uri, default_branch, group?, root, indexed_at, graph_hash }] }
Use whenYou want symbols, files, or communities for a natural-language phrase. The result is grouped by execution-flow process.
Avoid whenYou need precise callers/callees of a known symbol — call context instead.
Inputstext (required), repo?, repo_uri?, limit?, granularity?: "symbol" | "file" | "community", bm25_only?, goal?, context?
Returns{ processes: [{ name, steps, files }], symbols: [{ id, name, file_path, kind, score }], next_steps }
Use whenYou have a specific symbol and need its callers, callees, ACCESSES edges, and the processes it participates in.
Avoid whenYou only have a fuzzy concept — call query first.
Inputssymbol (required), repo?, repo_uri?, file_path?, kind?
Returns{ target, callers, callees, accesses, processes, next_steps }
Use whenYou’re about to edit a symbol and need the blast radius (dependents, processes, risk tier).
Avoid whenYour change is purely additive (new file, new function with no callers).
Inputssymbol (required), repo?, repo_uri?, depth? (default 3), direction?: "up" | "down" | "both"
Returns{ target, direct_callers, transitive_callers, affected_processes, risk: "LOW" | "MEDIUM" | "HIGH" | "CRITICAL", confidence, next_steps }
Use whenThe agent has a staged or compared diff and needs the affected symbols, files, and processes with risk tiers.
Avoid whenThe tree is clean (the tool refuses with a helpful error).
Inputsrepo?, repo_uri?, scope?: "unstaged" | "staged" | "all" | "compare" (default all), compare_ref?, strict?
Returns{ symbols, files, processes, max_risk, next_steps }
Use whenCoordinating a multi-file symbol rename. Default mode is dry-run.
Avoid whenThe rename is in a single file — let the editor handle it.
Inputsfrom, to, repo?, repo_uri?, dry_run? (default true)
Returns{ edits: [{ file_path, line, before, after, confidence }], cross_module_refs, next_steps }
Use whenYou need a custom view of the graph that no other tool exposes. Read-only. 5-second timeout.
Avoid whenA typed tool (context, impact, query) already covers the question. SQL is the escape hatch.
Inputsquery (required), repo?, repo_uri?
Returns{ rows: [...], row_count, next_steps }

Cross-repo tools. Backed by the typed Repo graph node and the group registry (ADR 0012). Every group tool emits repo_uri in the canonical form so a follow-up AMBIGUOUS_REPO retry can use it as input.

Use whenThe agent does not know which groups are configured.
Inputs
Returns{ groups: [{ name, description?, member_repo_uris }] }
Use whenOne BM25/vector query over an entire fleet of repos. Fused with reciprocal-rank fusion (RRF).
Inputsgroup, text, limit? (default 20)
Returns{ group, results: [{ repo_uri, hits: [...] }], next_steps }
Use whenPer-repo staleness audit before relying on cross-repo answers.
Inputsgroup
Returns{ group, repos: [{ repo_uri, indexed_at, graph_hash, staleness_lag_commits }] }
Use whenYou need the cross-repo HTTP contract matrix (consumer ↔ producer routes).
Inputsgroup
Returns{ contracts: [{ producer_repo_uri, route, consumer_repo_uri, handler }], unresolved_fetches }
Use whenYou need the audit trail of every cross-repo edge with a typed source/target.
Inputsgroup
Returns{ links: [{ source_repo_uri, target_repo_uri, source_doc_path, target_doc_path, relation }] }
Use whenAfter a group member has been re-indexed, rebuild the cross-repo contract registry and link table.
Inputsgroup
Returns{ group, contracts_written, cross_links_written, next_steps }

scan is the only tool that spawns processes (openWorldHint=true). verdict exits 0/1/2/3 by tier — the canonical source of CI signal.

Use whenYou want fresh SARIF findings for the repo. Picks scanners from the project profile or an explicit list.
Inputsrepo?, repo_uri?, scanners?: string[], severity?: string[], concurrency?, timeout_ms?
Returns{ scanners_run, sarif_path, summary: { by_tool, by_level }, next_steps }
Use whenBrowse findings without re-running scanners.
Inputsrepo?, repo_uri?, severity?, tool?
Returns{ findings: [{ rule_id, severity, file_path, start_line, message, fingerprint }], next_steps }
Use whenDiff the current scan against a frozen baseline.
Inputsbaseline (path), repo?, repo_uri?
Returns{ new, fixed, unchanged, updated, next_steps }
Use whenFind symbols with zero in-graph references and dead exports.
Inputsrepo?, repo_uri?
Returns{ candidates: [{ id, name, file_path, kind, reason }] }
Use whenRemove specific dead symbols from disk. Dry-run is the default.
Inputsrepo?, repo_uri?, targets: string[], dry_run?
Returns{ removed, skipped, next_steps }
Use whenTier the dependency license posture: copyleft / unknown / proprietary / permissive.
Inputsrepo?, repo_uri?
Returns{ tiers: { permissive, copyleft, unknown, proprietary }, dependencies, next_steps }
Use whenOne PR-level decision tier. Wraps detect_changes + impact + findings + owners.
Inputsrepo?, repo_uri?, base? (default main), head? (default HEAD)
Returns{ tier: "auto_merge" | "single_review" | "dual_review" | "expert_review" | "block", exit_code, reasons, signals }
Use whenPer-community risk trend lines plus a 30-day projection.
Inputsrepo?, repo_uri?
Returns{ communities: [{ id, name, trend, projection_30d, drivers }] }

For services. Each tool is a thin slice over the Route graph node and its consumers.

Use whenList every HTTP route in the repo with its handler and known consumers.
Inputsrepo?, repo_uri?
Returns{ routes: [{ method, path, handler, consumers, framework }] }
Use whenBlast radius for a route change. Walks FETCHES edges across repos when the repo is in a group.
Inputsroute, repo?, repo_uri?
Returns{ route, direct_consumers, transitive_consumers, risk, next_steps }
Use whenValidate that callers expect the response shape the handler currently returns.
Inputsroute, repo?, repo_uri?
Returns{ route, mismatches: [{ consumer, expected, actual }], next_steps }
Use whenList MCP tools defined in the repo (for repos that ship their own MCP server).
Inputsrepo?, repo_uri?
Returns{ tools: [{ name, file_path, schema, examples }] }
Use whenOne-shot summary of language mix, entry points, top processes, owners.
Inputsrepo?, repo_uri?
Returns{ languages, entry_points, top_processes, top_owners, frameworks, ia_types, api_contracts }
Use whenDependency inventory (production + dev).
Inputsrepo?, repo_uri?
Returns{ production, development, peer, by_package_manager }
Use whenTop contributors for a node (file, symbol).
Inputsnode, repo?, repo_uri?
Returns{ owners: [{ name, email, share, last_touch }], bus_factor }
Use whenProduce a deterministic LLM-ready code-pack snapshot of the repo (powered by the bundled deterministic pack).
Inputsrepo?, repo_uri?, path?, style?: "xml" | "markdown" | "json" | "plain", compress?, remove_comments?
Returns{ output_path, item_count, total_chars, token_estimate, next_steps }
  • MCP overview — server name, transport, envelope conventions, and the AMBIGUOUS_REPO retry pattern.
  • Error codes — the structured error envelope under structuredContent.error.
  • Resources — structured views alongside the tools.
  • Tool catalog (JSON) — machine-readable form an agent can fetch.