Skip to main content
Glama

Record a running program

perf_attach

Attach to an already running program by PID or command-line name, record it for a set duration, and return perf_record's summary while the program keeps running.

Instructions

Records a program that is already running, by pid or by a name in its command line, for seconds, and returns perf_record's summary; the program keeps running. For games from Steam, CrossOver or any launcher: start the game first.

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": {
      "label": "<label>",
      "process": "<process>"
    },
    "name": "perf_attach"
  }
}

Input Schema

NameRequiredDescriptionDefault
labelYesname: letters, digits, '.', '_', '-'
fieldsNoresult paths to keep, dotted: common.frame_pacing
processYespid, or a name in the program's command line such as Game.exe
secondsNorecording length, default 20

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.28.0
    • addedInput schema / properties / fields
      Added value: +{
      +  "description": "result paths to keep, dotted: common.frame_pacing",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / label / description
      Previous value: -"name for the run: letters, digits, '.', '_', '-'"New value: +"name: letters, digits, '.', '_', '-'"
    • changedInput schema / properties / seconds / description
      Previous value: -"recording length, default 20; the export afterwards takes several minutes under Wine"New value: +"recording length, default 20"
  2. Changed2 schema fields changedv0.10.1
    • changedInput schema / properties / seconds / description
      Previous value: -"recording length, default 20; the export afterwards takes about a minute"New value: +"recording length, default 20; the export afterwards takes several minutes under Wine"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "type": "object"
      +}
  3. Addedv0.7.1

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With hints already declaring destructiveHint=false and readOnlyHint=false, the description still adds real value by saying the target 'keeps running' and that it returns perf_record's summary. It does not disclose attach prerequisites (ptrace/permission elevation), what happens when attach fails, or whether any state is left behind, which matter for an observational but non-read-only tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two compact sentences, front-loaded with the core action and receiving only a small amount of explanatory tail. The line break is cosmetic noise but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, annotations cover the safety profile, and all four parameters are documented, so the description only needs to establish the attach-vs-launch distinction and the launcher workflow — both present. The only gap is failure/prerequisite behavior for an attach operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents label, fields, process and seconds with defaults. The description reinforces the process selector and the seconds duration, and the launcher note clarifies how to supply 'process', but it adds no format or constraint detail beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb (records/attaches) plus the resource (an already-running program), and pins down the selector ('by pid or by a name in its command line') and the duration. It clearly separates itself from a launch-and-record flow ('a program that is already running', 'the program keeps running') without naming perf_record as the alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a concrete when-to-use: programs started by a launcher (Steam, CrossOver) must be started first, then attached. That resolves the main real-world ambiguity. It stops short of explicitly naming perf_record as the tool to use when the harness should launch the program itself.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.