codemap_scan
Scan or re-scan a project directory to build the code knowledge graph
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
rootPath | string | ✅ Required | Root directory path of the project to scan |
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_scan",
"arguments": {
"rootPath": "/path/to/project"
}
}Example Output
JSON Response
json
{
"success": true,
"filesScanned": 245,
"directoriesScanned": 42,
"symbols": 1523
}When to Use This Tool
- Initial project indexing
- After major code changes
- When search results seem stale
- After git pulls/merges
- To rebuild code graph
Common Patterns
Initial Setup
Refresh After Changes
const codemap = new CodeMap('/path/to/project');
await codemap.scan();Refresh After Changes
// After making changes
await codemap.scan();Pro Tips
Scan once at start - Initial scan builds the knowledge graph
Re-scan after major changes - Keeps graph up-to-date
Automatic in many tools - Most CodeMap tools auto-scan if needed
Re-scan after major changes - Keeps graph up-to-date
Automatic in many tools - Most CodeMap tools auto-scan if needed
Best Practices
Scan before long sessions - Ensure graph is current
Don't over-scan - Scanning is automatic when needed
Check stats - Verify expected file/symbol counts
Don't over-scan - Scanning is automatic when needed
Check stats - Verify expected file/symbol counts
Common Mistakes
❌ Mistake: Scanning after every small change
✅ Instead: Let auto-scan handle it
await codemap.write({ path: 'file.ts', content: '...' });
await codemap.scan(); // Unnecessary - auto-scans✅ Instead: Let auto-scan handle it
await codemap.write({ path: 'file.ts', content: '...' });
// CodeMap auto-scans when needed