Loading patterns…
Tool Retrieval (Tool RAG)(TR)
When an agent can reach hundreds or thousands of tools or MCP servers, loading every schema into the prompt is expensive and hurts selection accuracy. Tool retrieval indexes tool definitions and, for each query, retrieves only the semantically relevant ones (embedding search, active discovery, and reranking) before the model chooses. RAG-MCP reports tool-selection accuracy rising from about 13 percent to 43 percent while cutting prompt tokens by more than half.
In 30 seconds
- What
- Indexes tool definitions by embedding, retrieves only semantically relevant schemas per query, then reranks before the model selects.
- When to use
- Agents access hundreds or thousands of tools and loading all schemas wastes tokens and degrades selection accuracy.
- Watch out
- Retrieval failures (poor embedding match or ranking) silently omit the correct tool, causing the agent to pick a suboptimal alternative.
Ask the AI expert about this pattern
Opens the assistant with your question prefilled. You review it before sending.
Tool Retrieval (Tool RAG): Overview
When an agent can reach hundreds or thousands of tools or MCP servers, loading every schema into the prompt is expensive and hurts selection accuracy. Tool retrieval indexes tool definitions and, for each query, retrieves only the semantically relevant ones (embedding search, active discovery, and reranking) before the model chooses. RAG-MCP reports tool-selection accuracy rising from about 13 percent to 43 percent while cutting prompt tokens by more than half.
- Vector index over tool and MCP server definitions
- Per-query semantic retrieval of relevant tools only
- Reranking to shortlist the top-k candidate tools
- Active, on-demand discovery instead of preloading all schemas
- Large prompt-token reduction versus loading every schema
- Higher tool-selection accuracy at scale (thousands of tools)
The Agent Architect
One pattern, one tradeoff, one production failure story. A short weekly briefing for people building agentic systems.
Weekly email, one-click unsubscribe. We only use your address to send the briefing.
References
The papers, specifications, and repositories this pattern is based on.
From the engineer behind this catalog
Get your agent architecture reviewed
This page documents one pattern. Your system runs dozens, and most failures live in how they fit together. Have the whole design reviewed against the 288 patterns in this catalog: architecture, reliability, evaluation and cost, every finding mapped to the pattern that fixes it.
€750 instead of €1,500, one week, written report and walkthrough call, until 30 September