Learning Library

← Back to Library

Search‑Driven Tool Calling in LLMs

Key Points

  • Effective research hinges on search, so multi‑agent systems must embed a robust search step to gather and refine information before answering.
  • Large language models (LLMs) cannot retrieve real‑time data on their own; they rely on **tool calling**, where the LLM requests external services (web, databases, search APIs) defined as named tools with input specifications.
  • In a tool‑calling workflow, the LLM sends a message plus a tool name to an application, which routes the request to the appropriate service, returns the results, and the LLM incorporates them into its response.
  • Common pitfalls include **hallucination** (the LLM invents a non‑existent tool) and **poor tool selection** (choosing the wrong service, e.g., web instead of a database), problems that persist even with well‑designed tool sets.
  • While many open‑source frameworks simplify defining search and web tools, careful design and validation are essential to mitigate these errors and ensure reliable research‑oriented LLM behavior.

Full Transcript

# Search‑Driven Tool Calling in LLMs **Source:** [https://www.youtube.com/watch?v=pUUzXimhUuA](https://www.youtube.com/watch?v=pUUzXimhUuA) **Duration:** 00:09:55 ## Summary - Effective research hinges on search, so multi‑agent systems must embed a robust search step to gather and refine information before answering. - Large language models (LLMs) cannot retrieve real‑time data on their own; they rely on **tool calling**, where the LLM requests external services (web, databases, search APIs) defined as named tools with input specifications. - In a tool‑calling workflow, the LLM sends a message plus a tool name to an application, which routes the request to the appropriate service, returns the results, and the LLM incorporates them into its response. - Common pitfalls include **hallucination** (the LLM invents a non‑existent tool) and **poor tool selection** (choosing the wrong service, e.g., web instead of a database), problems that persist even with well‑designed tool sets. - While many open‑source frameworks simplify defining search and web tools, careful design and validation are essential to mitigate these errors and ensure reliable research‑oriented LLM behavior. ## Sections - [00:00:00](https://www.youtube.com/watch?v=pUUzXimhUuA&t=0s) **Search as Core of Tool‑Calling** - The passage explains that effective research in multi‑agent systems hinges on a central search step, requiring LLMs to use tool‑calling mechanisms that invoke external APIs or databases to retrieve up‑to‑date information. - [00:03:11](https://www.youtube.com/watch?v=pUUzXimhUuA&t=191s) **LLM Tool-Calling Pitfalls** - The speaker explains the typical request‑routing flow for LLMs and then points out major drawbacks of current tool‑calling approaches—hallucinated tool names, poor tool selection (choosing the wrong database or API), and the added complexity that can cause incorrect or missing data. - [00:06:16](https://www.youtube.com/watch?v=pUUzXimhUuA&t=376s) **MCP: Uniform AI Integration** - The speaker explains the Model Context Protocol (MCP), a standardized client‑server framework that lets LLMs reliably connect to external tools and knowledge sources, simplifying integration, enabling plug‑and‑play connectivity, and improving trustworthiness. - [00:09:30](https://www.youtube.com/watch?v=pUUzXimhUuA&t=570s) **Standardized Search with MCP** - The speaker highlights how protocols like MCP are rapidly streamlining the integration and scaling of search tools for developers and data scientists, stressing that thoughtful review of search strategies is essential to fully exploit AI-driven research. ## Full Transcript
0:00You literally can't spell the word research. 0:08Without the word search. 0:12And in a multi-agentic system 0:14that imitates the way that we naturally perform research, 0:18where we start by defining our research objective, 0:24where we make a plan. 0:29Define plan. 0:32Where we gather the information 0:35and perform a search over different data sets, where we 0:40refine. 0:45Based on the data that we gather 0:47and in light of the plan, and finally generate or respond 0:53with an answer. 0:56You can see that search 0:58is actually at the heart of this process. 1:02And so careful consideration must be given to its implementation. 1:06To understand how search agents are implemented today. 1:11We first have to revisit the idea of tool calling. 1:21Now remember, 1:22LLMs by themselves can't search. 1:27They're not connected to the internet. 1:29They're not connected to databases or search APIs, 1:34so they don't have access to retrieve real-time relevant information. 1:40So tool calling is the process 1:42by which the LLM invokes these services. 1:48Whether it's web, 1:54or a database, 1:58or an API. 2:02By virtue of an application 2:06that exposes these services as tools. 2:12Where each of these tools will have a name, 2:16they'll have a definition, 2:20a tool definition. 2:22And of course, they'll have some definition 2:25around the expected input. 2:29So tool calling the LLM 2:33calls this application. 2:37And then this application connects to these services. 2:40And you can think of this database for example. 2:43And this search API as 2:46the way that you could define or provide 2:50custom knowledge sources to your tool 2:55calling agent or tool calling LLM. 2:59Now how the LLM 3:00does this is it sends in response to a query, 3:04it sends a message 3:07and also a tool name to the application. 3:11Then the application routes this request formats and routes this request 3:16to the appropriate service comes back 3:18with data to the LLM. 3:22And then the LLM uses that data to generate an answer. 3:30Where in the 3:32context of our research system will be 3:36here's what I found in response to this query or that query. 3:40Now tool calling is very common today. 3:43And several open source frameworks make it easy 3:46to define these search tools. 3:50And web tools in your app. 3:51But there are a couple of issues with this approach. 3:57So for example, 3:59this LLM can hallucinate. 4:08So in response to a query, when it generates this message 4:12and this tool, it could just make up a tool name for a tool that doesn't exist. 4:18And so no tool 4:22no data. 4:27The next thing that could happen 4:28is what I like to call poor selection. 4:35This may also be a function of the LLM 4:38where some LLMs are better at others at function calling. 4:44And so the LLM might actually choose the wrong tool, 4:48for a particular query. 4:51So it may go to the web in order to fetch information when actually 4:55it should have gone to a database or a search 4:58API, for a particular query. 5:02But other times it may be out of the LLMs control. 5:06So imagine if you 5:08had a situation where you had multiple databases 5:12and multiple search APIs defined in your application. 5:16Then even the best LLM for the job 5:19could accidentally choose the wrong tool. 5:27And therefore get wrong data. 5:32And then one last one 5:34that is a drawback for 5:37this approach is complexity. 5:42What do I mean by that? 5:44Well, as a data scientist or developer 5:49you are responsible to define this application. 5:52And so if the service provider changes some of the APIs 5:57that are underlying to your tool definition in your application, 6:02then it caused the whole application to break, therefore 6:06causing your research agent to break. 6:11And so the complexity is around 6:13app maintenance. 6:18Now enter 6:20model context protocol. 6:28Or MCP for short. 6:39Think of MCP 6:40as a standardized connector for LLMs. 6:44Much like how Rest standardized 6:47how we make calls to web APIs. 6:51Just as Rest offered a uniform way to interact with web services. 6:55MCP provides a consistent method for integrating 6:59AI models with external tools and knowledge sources. 7:03So with MCP, you have 7:06the concept of a MCP client. 7:15Where your LLM interacts 7:18with the external services 7:21through the client. 7:26Then you have the concept of a MCP server. 7:35And this MCP server connects 7:38to external services. 7:52Now the kicker here 7:55is that the MCP server 7:59that connects to the external services 8:02is managed by the service provider. 8:10And then on top of this, 8:12the LLM connects through 8:18the client. 8:21It simplifies 8:22the integration that we have over here in several key ways. 8:27So the first is that you have a uniform interface. 8:30Developers no longer need to create custom integrations for each tool. 8:36MCP provides a standardized method 8:38for connecting to various external services. 8:43It's also plug and play. 8:44So similar to how usb-c offers a universal connectivity for multiple 8:50devices. MCP allows AI models 8:54to connect seamlessly and to switch between services, and that uses or 9:00takes advantage of, the protocol between the client and the server 9:06called reflection. 9:12And then this all leads to trustworthiness. 9:14With MCP, LLMs are less likely to hallucinate 9:18or choose the wrong tool, because now there's a standard way 9:23and protocol to parse all the tools 9:27via the client server connection. 9:31So search is evolving rapidly 9:33with standardized protocols like MCP. 9:37Integrating and scaling search capabilities becomes 9:39far less burdensome for developers and data scientists. 9:44So whether you're building and optimizing or simply using these systems, 9:49carefully reviewing your search strategies will be key 9:52to unlocking the full potential of AI driven research.