Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ npm install -g @colbymchenry/codegraph
"mcp__codegraph__codegraph_callees",
"mcp__codegraph__codegraph_impact",
"mcp__codegraph__codegraph_node",
"mcp__codegraph__codegraph_explore",
"mcp__codegraph__codegraph_status",
"mcp__codegraph__codegraph_files"
]
Expand Down Expand Up @@ -387,6 +388,7 @@ When running as an MCP server, CodeGraph exposes these tools to Claude Code:
| `codegraph_callees` | Find what a function calls |
| `codegraph_impact` | Analyze what code is affected by changing a symbol |
| `codegraph_node` | Get details about a specific symbol (optionally with source code) |
| `codegraph_explore` | Explore source for several related symbols in one capped call |
| `codegraph_files` | Get indexed file structure (faster than filesystem scanning) |
| `codegraph_status` | Check index health and statistics |

Expand Down
49 changes: 49 additions & 0 deletions __tests__/tool-list-consistency.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { describe, expect, it } from 'vitest';
import * as fs from 'fs';
import * as path from 'path';

const repoRoot = path.resolve(__dirname, '..');
const MCP_TOOLS = [
'codegraph_search',
'codegraph_context',
'codegraph_callers',
'codegraph_callees',
'codegraph_impact',
'codegraph_node',
'codegraph_explore',
'codegraph_files',
'codegraph_status',
];

describe('MCP tool list docs stay in sync', () => {
it('serve help lists every MCP tool named in the README table', () => {
const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf-8');
const cli = fs.readFileSync(path.join(repoRoot, 'src/bin/codegraph.ts'), 'utf-8');

const table = readme.match(/## MCP Tools[\s\S]*?\| `codegraph_search`[\s\S]*?\| `codegraph_status`[^\n]*\n/);
expect(table).not.toBeNull();

const helpBlock = cli.match(/console\.error\('Available tools:'\);[\s\S]*?\n \}/);
expect(helpBlock).not.toBeNull();

for (const tool of MCP_TOOLS) {
expect(table![0]).toContain(`\`${tool}\``);
expect(helpBlock![0]).toContain(` ${tool}`);
}
});

it('Claude permission example covers every README-listed MCP tool', () => {
const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf-8');

const permissionBlock = readme.match(/"allow": \[[\s\S]*?\]/);
expect(permissionBlock).not.toBeNull();

const table = readme.match(/## MCP Tools[\s\S]*?\| `codegraph_search`[\s\S]*?\| `codegraph_status`[^\n]*\n/);
expect(table).not.toBeNull();

for (const tool of MCP_TOOLS) {
expect(table![0]).toContain(`\`${tool}\``);
expect(permissionBlock![0]).toContain(`mcp__codegraph__${tool}`);
}
});
});
1 change: 1 addition & 0 deletions src/bin/codegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ program
console.error(chalk.cyan(' codegraph_callees') + ' - Find what a symbol calls');
console.error(chalk.cyan(' codegraph_impact') + ' - Analyze impact of changes');
console.error(chalk.cyan(' codegraph_node') + ' - Get symbol details');
console.error(chalk.cyan(' codegraph_explore') + ' - Explore related source');
console.error(chalk.cyan(' codegraph_files') + ' - Get project file structure');
console.error(chalk.cyan(' codegraph_status') + ' - Get index status');
}
Expand Down