context_budget
Estimates how much of a model's context window a session has consumed, showing tools, history, and prompt usage with 50/80/95% thresholds so you can compact before overflow.
Instructions
Context Budget HUD: estimates how much of the model's context window this session has consumed (tools/history/prompts breakdown, 50/80/95% thresholds). Call before large multi-step tasks. When the threshold is warning or critical, immediately call tokensafe:compact_conversation on the session transcript.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "context_budget"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Optional: model name to resolve window size (default: env TOKENSAFE_CONTEXT_WINDOW or 200k) | |
| session_id | No | Optional: session identifier (default: mcp_session) | |
| window_tokens | No | Optional: explicit context window size in tokens | |
| transcript_path | No | Optional: path to the session JSONL transcript; when provided, REAL history mass is measured instead of the instrumented floor (recommended) |