Skip to main content
Glama

IA-QA — 152 QA & Dev Tools for AI Agents

context_window_check

Read-onlyIdempotent

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.

Input Schema

NameRequiredDescriptionDefault
modelYesModel id from list_llm_models (e.g. gpt-6.1-sol, claude-sonnet-5-5)
messagesYesArray of messages (system/user/assistant)
max_output_tokensNoReserved tokens for output (default: 4096)

Output Schema

NameRequiredDescriptionDefault
fitsNo
roleNo
charsNo
indexNo
modelNo
tokensNo
warningsNo
breakdownNo
per_messageNo
total_tokensNo
message_countNo
context_windowNo
total_input_tokensNo
utilization_percentNo
reserved_output_tokensNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / model / description
      Previous value: -"Target model name (e.g. gpt-4o, claude-3.5-sonnet)"New value: +"Model id from list_llm_models (e.g. gpt-6.1-sol, claude-sonnet-5-5)"
  2. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "messages": [
      +      {
      +        "content": "hi",
      +        "role": "user"
      +      }
      +    ],
      +    "model": "gpt-4o"
      +  }
      +]
  3. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "breakdown": {
      +    "type": "object"
      +  },
      +  "chars": {
      +    "type": "number"
      +  },
      +  "context_window": {},
      +  "fits": {},
      +  "index": {},
      +  "message_count": {
      +    "type": "number"
      +  },
      +  "model": {},
      +  "per_message": {},
      +  "reserved_output_tokens": {},
      +  "role": {},
      +  "tokens": {},
      +  "total_input_tokens": {},
      +  "total_tokens": {},
      +  "utilization_percent": {
      +    "type": "string"
      +  },
      +  "warnings": {}
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  5. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so safety is covered. The description contributes one extra behavioral trait, that it emits truncation-risk warnings, but says nothing about estimation accuracy/approximation, per-message overhead handling, or how the max_output_tokens reservation affects the verdict.

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?

Two tight sentences with the operation and the warning behavior front-loaded; no filler. Minor redundancy in re-specifying the message object shape that the schema already defines.

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?

With an output schema present, the description need not explain return values, and it correctly omits them. It covers the core call intent, but given three sibling token tools, the missing disambiguation and estimation-caveats keep it from fully complete.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description restates the message shape (role/content) already documented in the schema and adds no semantics for max_output_tokens or how model ids affect the estimate; the pointer to list_llm_models lives in the schema, not the description.

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 a specific verb and resource set: estimate token usage for a message array against a target model's context window. It clearly conveys the check/fit assessment and adds 'warns about truncation risk'. It stops short of naming the near-duplicate siblings (count_tokens, token_budget_calculator), so an agent must infer the boundary itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Use is implied ('check if it fits in the target model's context window') as a pre-flight validation step, but there is no explicit when-to-use/when-not guidance and no mention of how it differs from count_tokens or token_budget_calculator. The agent must disambiguate from three similar token-related siblings unaided.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.