Skip to main content
Glama

check_context_budget

Monitor context window usage and remaining capacity to manage token limits effectively. Returns token metrics and status indicators for informed session management.

Instructions

Check current context window usage and remaining capacity. Returns tokens used, remaining, percentage, and status (sufficient/low/critical).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_limitNoMaximum context tokens. Default: 156000 (200K * 0.78)

Implementation Reference

  • The _check_context_budget function calculates the context usage using TranscriptParser and returns token statistics.
    async def _check_context_budget(arguments: dict[str, Any]) -> dict:
        """Check context window usage."""
        context_limit = arguments.get("context_limit", DEFAULT_CONTEXT_LIMIT)
    
        parser = TranscriptParser()
        budget = parser.get_context_budget(context_limit)
    
        return {
            "tokens_used": budget.tokens_used,
            "tokens_remaining": budget.tokens_remaining,
            "percentage_used": budget.percentage_used,
            "context_limit": budget.context_limit,
            "status": budget.status,
        }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool as a read-only check operation and details the return values (tokens used, remaining, etc.), which is helpful. However, it lacks information on potential side effects, error conditions, or performance characteristics, leaving gaps in behavioral understanding for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded, consisting of two sentences that efficiently convey the tool's purpose and return values without any wasted words. Every sentence earns its place by providing essential information, making it easy for an agent to parse and understand quickly.

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?

Given the tool's low complexity (one optional parameter, no output schema, no annotations), the description is reasonably complete. It explains what the tool does and what it returns, which is sufficient for basic usage. However, the lack of output schema means the description could benefit from more detail on return formats or examples, slightly limiting completeness.

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

Parameters4/5

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

The input schema has 100% description coverage, documenting the single optional parameter (context_limit) with its type, default, and purpose. The description does not add parameter details beyond the schema, but with only one optional parameter and high schema coverage, this is acceptable. The baseline is 3, but the simplicity and full schema coverage justify a 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('check', 'returns') and resources ('context window usage and remaining capacity'), distinguishing it from siblings like get_session_history or sync_planning_doc. It explicitly lists what information is returned (tokens used, remaining, percentage, status), making the purpose unambiguous and distinct.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives or in what context it should be invoked. It does not mention prerequisites, timing, or comparisons to sibling tools like should_reset_context, leaving the agent to infer usage based solely on the purpose statement.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TimEvans/ccsession'

If you have feedback or need assistance with the MCP directory API, please join our Discord server