Skip to main content
Glama

context_budget_plan

Generate a deterministic ranked token-reduction plan for context files that exceed a set budget, with line ranges, tokens freed, safety actions, and apply/verify steps.

Instructions

Use before appending more than ~50 lines or when CLAUDE.md, AGENTS.md, Cursor rules, or prompts exceed budget. Input: required integer budget plus optional maxFindings, includeDiff, and apply. Returns a deterministic ranked plan with file line ranges, tokensFreed, confidence, safety actions, preserve spans, and satisfiable/minAchievable stop state. Apply entries in order by startLine/endLine, never rewrite a file, never cut preserve spans except by applying the condensedText of a condense entry exactly as given, stop when satisfiable is false, and call context_budget_verify after edits. The plan is saved under .ctxcap/plans for 24 hours.

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": {
      "budget": "<budget>"
    },
    "name": "context_budget_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
applyNo
budgetYes
includeDiffNo
maxFindingsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full burden, and it does disclose real behavior: determinism, the plan persistence location and 24-hour lifetime, safety actions, preserve spans, and hard constraints ('never rewrite a file', 'never cut preserve spans'). The significant gap is the 'apply' flag: the text lists it as an optional input but never says whether it executes the edits, and the surrounding instructions ('apply the condensedText ... exactly as given') blur whether the agent or the tool performs the mutation.

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 trigger is correctly front-loaded and the output fields, workflow rules, and persistence note follow in a logical sequence. It is dense but mostly earns its length; the third sentence chains several instructions into one long clause, which costs some scannability.

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

Completeness3/5

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

For a no-annotations, no-output-schema tool the description does heavy lifting on the return shape and post-call workflow, which is the right priority. What is missing is the semantics of the mutation-adjacent inputs (apply, includeDiff) and the unit of budget, which an agent needs before it can invoke the tool correctly.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must define all four parameters, and it merely enumerates them: 'required integer budget plus optional maxFindings, includeDiff, and apply'. No unit is given for budget (tokens? lines?), no meaning for maxFindings or includeDiff, and no behavior for apply. Naming a parameter is not explaining it.

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 names the resource (context budget) and the concrete artifact produced: a deterministic ranked plan with line ranges, tokensFreed, confidence and a satisfiable stop state. That is far more specific than a restatement of the name. It does not, however, distinguish this tool from siblings like trim_to_budget or measure_context, which could plausibly be reached for the same trigger condition.

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 an explicit trigger threshold ('before appending more than ~50 lines') and a condition ('when CLAUDE.md, AGENTS.md, Cursor rules, or prompts exceed budget'), plus a stop rule ('stop when satisfiable is false') and a mandated follow-up ('call context_budget_verify after edits'). Ordering of application is also specified. This is about as unambiguous as usage guidance gets.

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