Standardizing Retrieval Access with Tools and MCP
This lesson explains how exposing retrieval through standard interfaces, tools, MCP and REST APIs, prevents duplicated code and inconsistent behaviour across many assistants and agents.
Learning outcomes
After completing this lesson, you will be able to:
- Expose retrieval as a tool.
- Implement retrieval once in an MCP server.
- Publish a standard retrieval API.
Retrieval as a tool
In a fixed RAG pipeline, every request triggers retrieval, whether or not the question needs it, and retrieval happens exactly once with the user's words. Function calling, also called tool use, gives the model control instead. Retrieval is defined as a tool with a name, a description that tells the model when to use it, and an input schema, such as a query string and optional filters.
The model then decides whether to search, chooses the arguments, such as a refined query and a product filter, and may search several times, refining its query based on what it found. This approach, called agentic retrieval, avoids unnecessary retrieval for greetings or general questions and handles multi-step research better than a single fixed retrieval, at the cost of extra model calls and less predictable latency. The tool's description is critical, because it is the only guidance the model has about when the tool is useful, as the following definition shows.
"toolConfig": {"tools": [{"toolSpec": {
"name": "search_policies",
"description": "Search company HR policies. Use for any question about leave, benefits or conduct.",
"inputSchema": {"json": {"type": "object", "properties": {
"query": {"type": "string", "description": "Standalone search query"},
"region": {"type": "string", "enum": ["EU", "US", "APAC", "GLOBAL"]}},
"required": ["query"]}}}}]}Agentic retrieval
Retrieval through MCP
The Model Context Protocol (MCP) standardises how applications expose tools and data to models. An MCP server implements a retrieval tool once, for example calling a knowledge base's Retrieve API with the right filters, and any MCP client, such as an agent built with Strands Agents, an IDE assistant or an AgentCore-hosted agent, discovers and calls it the same way. AgentCore Gateway can expose existing Lambda functions and APIs, including retrieval functions, as MCP tools with authentication. MCP is covered in depth in the module "Model Context Protocol and Amazon Bedrock AgentCore".
The following diagram shows every assistant using the same retrieval layer.

One retrieval layer for many clients
Standard retrieval APIs
Applications that do not use tools still benefit from a standard interface: a REST API in API Gateway, defined with an OpenAPI specification, that accepts a query, filters and the user's identity and returns chunks in a consistent schema with text, score, source and metadata. Behind it, a Lambda function enforces access filters, calls the knowledge base or vector store, applies reranking and logs the request. Every application gets the same retrieval quality, security filtering and observability. The following table compares the access mechanisms.
| Mechanism | Who decides to retrieve | Best for |
|---|---|---|
| Fixed retrieval before generation | Application, every request | Simple question answering |
| Retrieval tool (function calling) | The model | Agents and multi-step research |
| MCP server | The model, through any MCP client | Many agents and frameworks sharing tools |
| Standard REST retrieval API | Application | Non-agent applications needing consistent retrieval |
Many assistants, one retrieval layer
Six teams build assistants with different frameworks over the same policy knowledge base. Each implemented retrieval differently, and two forgot to apply the access filters.
A shared MCP server (or AgentCore Gateway target) that wraps the knowledge base, applies access filters from the caller's identity and returns a standard result schema gives every agent the same, secure retrieval. A REST API with the same logic serves applications that do not use MCP.
What is the benefit of exposing retrieval as a tool rather than retrieving before every request?
Show answer
The model decides when to search and what to search for, so retrieval happens only when it is needed.
Exam Tips
Remember for the exam
- Let the model decide when and how to search: retrieval as a tool.
- One retrieval implementation for many agents and frameworks: MCP server.
- Expose existing retrieval functions as MCP tools: AgentCore Gateway.
- Enforce access filters centrally in the shared retrieval layer.