extract_hottest_functions
Parses a V8 .cpuprofile file and returns the top functions by exclusive CPU time, filtering out internals and collapsing framework frames to identify user-code hotspots.
Instructions
Parses a V8 .cpuprofile file and returns the top N functions ranked by exclusive CPU time (self time). Filters out V8 internals and Node.js built-ins by default, returning only user code. Framework frames (express, next.js, koa, etc.) can be collapsed into a single entry. Recursive calls to the same source location are merged with an instanceCount field. Use this first to identify which functions are consuming the most CPU in a Node.js performance profile.
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": "extract_hottest_functions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | Number of hottest functions to return (default: 10) | |
| profile_path | Yes | Absolute path to the .cpuprofile file | |
| min_self_percent | No | Minimum self time percentage to include a function (default: 0.5%) | |
| collapse_recursion | No | Merge multiple nodes with the same source location (functionName + url + line + column) into one entry. instanceCount shows how many recursive instances were merged (default: true) | |
| collapse_frameworks | No | Collapse all frames from known frameworks (express, next.js, koa, fastify, nestjs, react, vue, nuxt, hapi) into a single "<framework> internals>" entry per framework. Prevents dozens of small framework entries from diluting the top-N list (default: true) | |
| include_node_internals | No | Include V8 internals and Node.js built-ins in results (default: false) |