Skip to main content
Glama

set_thread_budget

DestructiveIdempotent

Replaces a thread's entire budget envelope—tokens, cost, turns, and wall-clock time—requiring all limits so an omitted cap cannot leave a run unbounded.

Instructions

REPLACE a thread's whole budget envelope. Every dimension must be stated — max_tokens, max_usd_micros ($1 = 1000000), max_turns, max_wall_secs — and null means no cap on that dimension. Omitting one is an error rather than a silent removal, because a removed cap never binds and the run it should have stopped keeps going. Use update_thread_budget to change some dimensions and leave the rest alone. An unrecognized key is rejected rather than ignored. Accumulated usage is preserved. When a dimension is exceeded, report_usage stops the run.

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": {
      "thread_id": "<thread_id>",
      "max_tokens": "<max_tokens>",
      "max_usd_micros": "<max_usd_micros>",
      "max_turns": "<max_turns>",
      "max_wall_secs": "<max_wall_secs>"
    },
    "name": "set_thread_budget"
  }
}

Input Schema

NameRequiredDescriptionDefault
max_turnsYes
thread_idYes
max_tokensYes
max_wall_secsYeswall-clock budget vs the working clock
max_usd_microsYesUSD in micros ($1 = 1000000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv479.0.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=true, and the description adds substantial context beyond them: null means uncapped, omission is rejected rather than treated as removal, unknown keys are rejected, accumulated usage survives the replace, and report_usage enforces the limits at runtime. The rationale for the omission-is-an-error rule explains the destructive consequence in a way annotations cannot.

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?

The definition is front-loaded with the replace semantics and the all-required rule before the alternative tool and edge cases. Every sentence carries information, though the final sentence about report_usage is somewhat tangential to the calling decision and the block is denser than a typical definition.

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?

For a destructive, all-parameters-required mutation with no output schema, the description supplies the null semantics, error behavior, and enforcement mechanism an agent needs to call it safely. The remaining gap is minor: it never states what happens to in-flight runs at the moment of replacement or what the response contains.

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 only 40% (max_tokens, max_turns, and thread_id are undocumented in the schema), and the description compensates by naming every budget dimension, defining the micros convention ($1 = 1000000), and specifying that null means no cap on that dimension. It does not explain units for max_turns or max_tokens, or that thread_id identifies the target, so it stops short of full coverage.

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?

The opening sentence gives a specific verb and resource - 'REPLACE a thread's whole budget envelope' - and immediately contrasts with the sibling update_thread_budget for partial changes. An agent can distinguish a full-overwrite tool from a partial-update tool without opening either schema.

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?

It states explicitly to use this tool when replacing the entire envelope and to use update_thread_budget when changing only some dimensions. It also names the failure mode for partial input (omitting a key is an error, not a silent removal), which removes ambiguity about when this tool is appropriate.

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

Deploy Server

Other Tools