Skip to content

Commit e9fd336

Browse files
kecsapcarlos-alm
andauthored
Implemented selective disable of tools to spare with the initial schema size (#1035)
* feat(mcp): selectively disable tools to reduce initial schema size * fix(mcp): address greptile review feedback - Reorder createCallToolHandler so the disabled-tool check runs before validateMultiRepoAccess, giving config-disabled tools a consistent "Unknown tool" response regardless of multi-repo state. - Mark CodegraphConfig.mcp.disabledTools optional to match the runtime guard (config.mcp?.disabledTools) and tolerate partial configs. - Update list_repos single-repo test to reflect the unified "Unknown tool" path. - Apply biome formatting to normalizeToolName. * docs(mcp): document mcp.disabledTools config - README: short subsection under Configuration with example and link. - docs/guides/mcp-tool-filtering.md: extensive guide covering motivation, name normalization, runtime behavior, full tool catalog, and recipes. * docs(config): replace mcp-only guide with full config reference Per review feedback, the previous guide was too narrowly scoped. Replace with docs/guides/configuration.md covering every key in DEFAULTS: file selection, build, query, embeddings, llm, search, ci, manifesto, check, coChange, analysis, community, structure, risk, display, mcp. README points to the new guide and keeps the short MCP tool-filtering example for the PR's headline feature. * fix(mcp): simplify disabledTools to always be an array (#1035) Impact: 1 functions changed, 1 affected * refactor(mcp): remove unreachable list_repos branch (#1035) The 'list_repos' tool is excluded from 'enabledToolNames' when 'multiRepo' is false, so 'createCallToolHandler' rejects single-repo 'list_repos' calls with 'Unknown tool' before they ever reach 'validateMultiRepoAccess'. That made the 'name === "list_repos"' branch unreachable. Drop the dead branch and the now-unused 'name' parameter; existing test 'rejects list_repos in single-repo mode' covers the early-rejection path. --------- Co-authored-by: carlos-alm <contato@carlosalmeida.com> Co-authored-by: carlos-alm <127798846+carlos-alm@users.noreply.github.com>
1 parent 20b8596 commit e9fd336

8 files changed

Lines changed: 554 additions & 17 deletions

File tree

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ Copy `.github/workflows/codegraph-impact.yml` to your repo, and every PR will ge
773773
774774
## 🛠️ Configuration
775775

776-
Create a `.codegraphrc.json` in your project root to customize behavior:
776+
Create a `.codegraphrc.json` in your project root to customize behavior. The snippets below cover the most-used keys — see **[docs/guides/configuration.md](docs/guides/configuration.md)** for the full reference (every group, every key, every default).
777777

778778
```json
779779
{
@@ -833,6 +833,20 @@ The command is split on whitespace and executed with `execFileSync` (no shell in
833833

834834
Works with any secret manager: 1Password CLI (`op`), Bitwarden (`bw`), `pass`, HashiCorp Vault, macOS Keychain (`security`), AWS Secrets Manager, etc.
835835

836+
### MCP tool filtering
837+
838+
Codegraph's MCP server exposes 30+ tools by default. For models with a small context window, you can shrink the schema by disabling tools you don't use:
839+
840+
```json
841+
{
842+
"mcp": {
843+
"disabledTools": ["execution_flow", "sequence", "communities", "co_changes"]
844+
}
845+
}
846+
```
847+
848+
Names are matched case-insensitively and a leading `codegraph<digits>_` prefix (e.g. `codegraph2_module_map`) is stripped before comparison. Disabled tools are removed from `tools/list` and any `tools/call` invocation returns `Unknown tool: <name>`. See **[docs/guides/configuration.md#mcp-tool-filtering](docs/guides/configuration.md#mcp-tool-filtering)** for the full tool catalog, and the rest of that guide for every other config option.
849+
836850
## 📖 Programmatic API
837851

838852
Codegraph also exports a full API for use in your own tools:

0 commit comments

Comments
 (0)