correlate_source_code
Resolve V8 CPU profile hotspots to original TypeScript source lines using source maps, falling back to compiled JS when maps are absent.
Instructions
Maps the hottest functions in a V8 CPU profile back to their original TypeScript source locations using source map files (.js.map). Falls back to compiled JS locations if no source map is found. Use to answer: which TypeScript file and line is the bottleneck actually coming from?
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"profile_path": "<profile_path>"
},
"name": "correlate_source_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | Number of hottest functions to resolve (default: 10) | |
| profile_path | Yes | Absolute path to the .cpuprofile file | |
| sourcemap_dir | No | Override directory to search for .map files (default: same directory as .js file) |