codemap_scan

Scan or re-scan a project directory to build the code knowledge graph

scanindexbuild

Parameters

NameTypeRequiredDescription
rootPathstring✅ RequiredRoot 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
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
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
⚠️Common Mistakes
Mistake: Scanning after every small change
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