Skip to content

profile_attach

MCP tools › Run, test and tasks

Attach the profiler to one of the user's running processes without restarting it: cpu samples from outside (macOS sample, Linux perf), memory takes a heap snapshot by class (macOS heap). Nothing is loaded into the process; JetBrains IDEs are refused. Dry run by default: returns tool and command. dry_run=false needs the user-granted run right, is logged, keeps the profile in .ferris-idea/profiles/ and returns it as profile_run does.

Its results carry text from process: the client is told to treat that as data, never as instructions.

Capabilityexecution.profile_attach
AreaRun, test and tasks
Accesschanges processes
Reachesprocess
Rightsrun
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
pidrequiredintegerProcess id of one of the user's processes (see profile_processes).minimum 0
secondsintegerSeconds to record (default 10, 1–120).minimum 0
kindstringcpu (default, sampling) or memory (heap snapshot, macOS).
dry_runbooleanOnly return what would run (default true).
only_projectbooleanProject code only (default false).
filestringWorkspace-relative file: add its per-line costs as lines.
timestringcpu (default) or total (Java only).
eventsbooleanAdd the recording's events, at most 500 (default false).

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project profile_attach '{"pid":1}'
Input schema as JSON
{
"type": "object",
"required": [
"pid"
],
"properties": {
"pid": {
"description": "Process id of one of the user's processes (see `profile_processes`).",
"type": "integer",
"minimum": 0
},
"seconds": {
"description": "Seconds to record (default 10, 1–120).",
"type": [
"integer",
"null"
],
"minimum": 0
},
"kind": {
"description": "`cpu` (default, sampling) or `memory` (heap snapshot, macOS).",
"type": [
"string",
"null"
]
},
"dry_run": {
"description": "Only return what would run (default true).",
"type": [
"boolean",
"null"
]
},
"only_project": {
"description": "Project code only (default false).",
"type": [
"boolean",
"null"
]
},
"file": {
"description": "Workspace-relative file: add its per-line costs as `lines`.",
"type": [
"string",
"null"
]
},
"time": {
"description": "`cpu` (default) or `total` (Java only).",
"type": [
"string",
"null"
]
},
"events": {
"description": "Add the recording's events, at most 500 (default false).",
"type": [
"boolean",
"null"
]
}
}
}