Skip to main content
Glama

prepare_context

Read-only

Build a task-specific, token-budgeted context pack from the most relevant pages: lexical rank, human-reviewed knowledge preferred, stale/deprecated concepts penalized, plus the top hits' link neighbors. Use it before multi-page product or coding work instead of many search/get_page calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesThe concrete task or question
keywordsNoSynonyms, and the workspace's language (e.g. English terms for a Turkish task)
maxTokensNoBudget for the returned JSON, approx. tokens
maxConceptsNo
trustPolicyNoprefer-human-reviewed
includeRelatedNoAdd title/id refs from the top concepts' link neighborhoods

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYes
policyYes
profileYes
relatedYes
conceptsYes
handlingYes
warningsYes
expiresAtNo
retrievalYes
truncatedYes
budgetTokensYes
contextRunIdNo
estimatedTokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / includeRelated / description
      Previous value: -"Include title/id references from the top concept's graph neighborhood"New value: +"Add title/id refs from the top concepts' link neighborhoods"
    • addedInput schema / properties / keywords
      Added value: +{
      +  "description": "Synonyms, and the workspace's language (e.g. English terms for a Turkish task)",
      +  "items": {
      +    "maxLength": 60,
      +    "type": "string"
      +  },
      +  "maxItems": 24,
      +  "type": "array"
      +}
    • removedInput schema / properties / maxConcepts / description
      Removed value: -"Maximum page concepts to include"
    • changedInput schema / properties / maxTokens / description
      Previous value: -"Approximate maximum tokens in the returned JSON"New value: +"Budget for the returned JSON, approx. tokens"
    • changedInput schema / properties / task / description
      Previous value: -"The concrete task or question to gather context for"New value: +"The concrete task or question"
  2. Added

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already provide readOnlyHint=true, and the description adds meaningful non-obvious behavior: lexical ranking, preference for human-reviewed knowledge, penalization of stale/deprecated concepts, and inclusion of link neighbors. This goes beyond the annotation surface and explains selection logic without contradicting the read-only hint.

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?

Two dense sentences with no filler. The behavioral core is front-loaded, and the usage guidance is delivered in a small, focused second sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the rich input schema, output schema, and annotations, the description covers purpose, selection behavior, usage timing, and alternatives. An agent has enough to decide when to invoke it and roughly what to expect without missing critical operational context.

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 coverage is 67%, so the schema does substantial work, but the description adds semantic color: 'lexical rank' clarifies how task/keywords drive relevance, 'human-reviewed knowledge preferred' maps to trustPolicy, and 'top hits' link neighbors' explains includeRelated. Only maxConcepts lacks any meaningful description, so the description partially compensates for the uncovered parameter.

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 uses a specific verb ('Build') and resource ('task-specific, token-budgeted context pack') and clearly differentiates the tool from siblings like search_workspace and get_page by describing a composite, page-synthesizing operation. This is immediately distinct from simple retrieval tools.

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

Usage Guidelines5/5

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

The description explicitly states when to use it: 'before multi-page product or coding work' and contrasts it with 'instead of many search/get_page calls'. This gives an agent direct routing guidance with a concrete alternative.

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.