context_window_check
Given an array of message objects [{role, content}], estimate total token usage and check if it fits in the target model's context window. Warns about truncation risk.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "hi"
}
]
},
"name": "context_window_check"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Model id from list_llm_models (e.g. gpt-6.1-sol, claude-sonnet-5-5) | |
| messages | Yes | Array of messages (system/user/assistant) | |
| max_output_tokens | No | Reserved tokens for output (default: 4096) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fits | No | ||
| role | No | ||
| chars | No | ||
| index | No | ||
| model | No | ||
| tokens | No | ||
| warnings | No | ||
| breakdown | No | ||
| per_message | No | ||
| total_tokens | No | ||
| message_count | No | ||
| context_window | No | ||
| total_input_tokens | No | ||
| utilization_percent | No | ||
| reserved_output_tokens | No |