Topic 3 of 5 · 4 min read
Live tool calls versus a prebuilt index
Goal: Decide for a given data source whether to index it, query it live through a tool, or expose it through an MCP server, and justify the choice.
Index data that is text to be read and changes slowly; call a tool for data that is a record to be looked up, changes quickly, or needs an exact answer. A copy in an index is always a little out of date. A live call is always current but costs a round trip.
Check yourself · 1 of 3
A user asks, "How many support tickets are open right now?" Which design fits?
Why it matters
RAG usually means "embed documents, search by similarity". That works for prose: manuals, policies, wiki pages. It works badly for questions like "What is the status of order 48213?" or "How many invoices are overdue?". Similarity search returns text that looks related, not the exact row. A stale copy of stock levels is worse than no answer.
How to choose
For each data source, ask four questions:
- How fast does it change? Minutes or seconds: query it live. Weeks or months: an index is fine.
- Is the answer an exact value or a passage? Exact values (a balance, a status, a count) come from SQL or an API. Passages come from retrieval.
- Who may see what? A live call can run as the signed-in user, so the source system's permissions apply. A shared index must carry access rules into every chunk, or it leaks.
- What does a miss cost? If a wrong answer means a refund or a lost sale, prefer the system of record.
A tool call can be hand-written for one app. If many applications need the same source, the Model Context Protocol (MCP) exposes it once as a server that any compatible client, such as Claude or Cursor, can call. Treat MCP as the plumbing for the tool option, not a third idea.
Before and after
Question: "Is the blue jacket in size M in stock at the Leeds store?"
Weak design: Embed a nightly export of the inventory sheet.
Answer: "Yes, 4 in stock" (the last 4 sold at 11:02).
Better design: Tool get_stock(sku, store_id) -> {"qty": 0}
The model reads the result and answers "No, 0 in stock."
Many real systems use both. A support agent searches the help-centre index for how-to articles, and calls get_order(order_id) for the customer's actual order.
What goes wrong
- Indexing a database table. Rows turned into text lose exact filtering and counts.
- A tool with no limits. An open SQL tool lets the model run any query. Use read-only roles and parameterised calls.
- Slow or flaky APIs. A live call adds latency and a new way to fail; set timeouts and return a clear error the model can report.
- Stale index treated as truth. Show the index date or send fresh data through a tool.
Examples
Which source gets which design
Help-centre articles: index them, they change monthly. Order status: tool call to the orders API. Overdue invoice count: a read-only SQL tool, because a count cannot come from similar-looking text. Company wiki: index, with page permissions stored on each chunk.
Same data, wrong design
A team embedded a nightly export of its pricing table. A customer was quoted a price that had changed at 9:00. The fix was a get_price(sku) tool that reads the price service directly, with the index kept only for product descriptions.
Key points
- Index slowly changing prose; call tools for fast-changing records and exact values such as status, balance or count.
- Similarity search returns passages that look related, which is the wrong shape for questions that need one exact row or a total.
- Live calls can run with the signed-in user's permissions, while a shared index must carry access rules into every chunk.
- MCP exposes one live source to many clients; it is a way to deliver the tool option, not a replacement for choosing it.
- Real products often combine an index for explanations with tools for records.
Common mistakes
- Embedding database rows and expecting similarity search to filter or count them.
- Serving fast-changing data from a nightly index.
- Giving a model unrestricted write or query access to a live database.
- Treating MCP as a separate strategy rather than a way to expose a tool.
Check yourself · 2 of 3
Which source is best handled with a prebuilt index?
Check yourself · 3 of 3
What does an MCP server add to a design that already needs live data?
Practice items, not counted towards your mastery.
Start here
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (opens in a new tab)PaperFree
The paper that named RAG: a model that reads retrieved passages instead of relying on memory alone.
- Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach (opens in a new tab)PaperFree
Measures long context against RAG on the same tasks and shows the cost gap that a hybrid router exploits.
- Optimizing LLM accuracy (OpenAI) (opens in a new tab)DocsFree
Frames the choice as context problems versus behaviour problems: RAG for the first, fine-tuning for the second.
More for this topic
- Introduction to the Model Context Protocol (opens in a new tab)DocsFree
The open standard for exposing live data and tools to models; the alternative to indexing a copy.