context_build
Builds ranked, token-budgeted context bundles from memories by searching, scoring, and optionally summarizing relevant results for LLM prompts.
Instructions
Build a ranked context bundle from memories using V2 API with optional AI summarization. Searches for relevant memories, ranks them by composite score, and optionally generates an AI summary. Useful for building token-efficient context windows for LLM prompts. Supports custom LLM endpoints (Ollama, llama.cpp, vLLM, etc.).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "context_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Context query describing what information is needed | |
| llm_model | No | Model name for custom LLM (e.g., "mistral", "llama3", "gemma") | |
| max_tokens | No | Token budget for context window (enforces truncation) | |
| ai_enhanced | No | Enable AI summarization of context (uses LLM) | |
| llm_api_url | No | Custom LLM API URL for summarization (OpenAI-compatible). Use for local LLMs: Ollama (http://localhost:11434/v1), llama.cpp, vLLM, LM Studio, etc. | |
| search_mode | No | Search mode: "semantic", "hybrid", or "keyword" | hybrid |
| max_memories | No | Maximum number of memories to include (1-100, default 20) | |
| exclude_memory_ids | No | Memory IDs to exclude (for multi-turn context building) |