Skip to main content
Glama

set_affinity

Idempotent

Assigns a process to specific logical processors, applying CPU affinity to all its threads until it exits.

Instructions

Sets which logical processors a process may run on (its affinity), all its threads at once, until it ends. get_cpu lists the processors; set_priority and set_efficiency_mode change how much time it gets rather than where. Critical processes and Anabolic are refused; a game or anti-cheat program needs force=true after the user agreed. Another user's process needs Anabolic's full access (cap_sys_nice).

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": {
      "pid": "<pid>",
      "cpus": "<cpus>"
    },
    "name": "set_affinity"
  }
}

Input Schema

NameRequiredDescriptionDefault
pidYesThe process ID (list_processes gives it).
cpusYesThe logical processors it may run on, from 0 to 63 (get_cpu lists them).
forceNoTrue only after the user agreed to the risk this tool described.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.6.0
    • changedInput schema / properties / cpus / description
      Previous value: -"The logical processors it may run on, from 0 (get_cpu lists them)."New value: +"The logical processors it may run on, from 0 to 63 (get_cpu lists\nthem)."
    • addedInput schema / properties / force / description
      Added value: +"True only after the user agreed to the risk this tool described."
    • addedInput schema / properties / pid / description
      Added value: +"The process ID (list_processes gives it)."
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Beyond the annotations it discloses that the change applies to all threads, persists until the process ends, and can be refused for critical or protected processes, plus the privilege requirement (cap_sys_nice) for other users' processes. This is rich, non-redundant context; the only gap is that the nature of the 'risk' behind force is not spelled out. The annotations (readOnlyHint=false, idempotentHint=true) stay consistent with the described set-and-persist behavior.

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

Conciseness5/5

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

Four tight sentences, front-loaded with what the tool does, then alternatives, then refusals and preconditions. No filler; each clause carries a distinct constraint the agent would otherwise have to guess.

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

Completeness5/5

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

For a 3-parameter mutation with no output schema, everything needed to call it correctly is present: effect scope, persistence, discovery path for CPU ids, refusal cases, and the privilege/consent preconditions for force.

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

Parameters4/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 the three parameters; the description goes further by explaining when force must be true (game/anti-cheat, only after user consent) rather than just restating its description. CPU indices are tied back to get_cpu for discovery.

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

Purpose5/5

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

States a specific verb and resource ('Sets which logical processors a process may run on (its affinity)') plus the scope ('all its threads at once, until it ends'). It explicitly separates itself from get_cpu (discovery) and set_priority/set_efficiency_mode (time rather than placement), so an agent can pick it without opening sibling schemas.

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

Usage Guidelines5/5

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

Gives concrete when-to-use routing ('get_cpu lists the processors; set_priority and set_efficiency_mode change how much time it gets rather than where') and explicit when-not/precondition cases: critical processes and Anabolic are refused, games or anti-cheat need force=true after user agreement, another user's process needs cap_sys_nice.

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