Skip to main content
Glama

context_window

Builds an optimal context window for queries by retrieving relevant memories and documents, prioritizing content, and truncating to fit token budgets for AI tool preparation.

Instructions

Build an optimal context window for a query within a token budget. Retrieves relevant memories and documents, assembles them in priority order, and truncates to fit. Use this to prepare context for another AI tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
token_budgetNo
include_documentsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses key behaviors: retrieves memories and documents, assembles in priority order, and truncates to fit token budget. However, it lacks details on how retrieval works (e.g., sources, recency), what 'optimal' means, error handling, or performance characteristics like rate limits.

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 two sentences, front-loaded with the core purpose, followed by a usage guideline. Every word earns its place with no redundancy or fluff, making it highly efficient and easy to parse.

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 complexity (involves retrieval, assembly, truncation), no annotations, and an output schema (which handles return values), the description is reasonably complete. It covers the main workflow but could benefit from more behavioral details (e.g., retrieval methods, priority criteria). The output schema reduces the need to explain returns.

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?

Schema description coverage is 0%, so the description must compensate. It explains the overall function (build context window for query with token budget) but doesn't detail individual parameters. However, with only 3 parameters (query, token_budget, include_documents), the high-level context is sufficient for basic understanding, though specifics like default values or boolean effects are missing.

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 clearly states the tool's purpose: 'Build an optimal context window for a query within a token budget.' It specifies the action (build), resource (context window), and key constraints (token budget). However, it doesn't explicitly differentiate from sibling tools like 'recall', 'deep_recall', or 'unified_search', which might have overlapping retrieval functions.

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

Usage Guidelines4/5

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

The description provides clear context for usage: 'Use this to prepare context for another AI tool.' This indicates it's a preparatory step rather than an end action. It doesn't specify when not to use it or name alternatives among siblings, but the guidance is practical and actionable.

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/besslframework-stack/project-tessera'

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