Trim Context
trim_contextCompacts retrieved context for a target operation before inference by dropping metadata, boilerplate, and repeats while preserving error lines, stack frames, trace IDs, and matching declarations.
Instructions
Compact retrieved context for one target operation before inference: drops metadata and boilerplate, collapses repeats, and keeps error lines, stack frames, trace ids and matching declarations verbatim. Deterministic unless useModel is true and the result is still over tokenBudget.
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": {
"rawContext": "<rawContext>",
"targetOperation": "<targetOperation>"
},
"name": "trim_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| useModel | No | Allow an LLM compaction pass when over budget. Default: false. | |
| rawContext | Yes | Raw retrieved text to compact. | |
| tokenBudget | No | Target size in estimated tokens. Default: 2000. | |
| targetOperation | Yes | What the downstream model must do with the context. |