Skip to content
mentoor

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?

Choose one answer

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:

  1. How fast does it change? Minutes or seconds: query it live. Weeks or months: an index is fine.
  2. 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.
  3. 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.
  4. 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?

Choose one answer

Check yourself · 3 of 3

What does an MCP server add to a design that already needs live data?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic