chapter three

3 Enabling actions: Tool use

 

This chapter covers

  • LLM limitations and why they need tools
  • Tool calling and execution
  • Building and integrating custom tools
  • MCP for tool standardization

On their own, LLMs can't access external data or interact with external systems. They need tools and the ability to select and utilize those tools, which is central to implementing agents. A basic agent performs tasks step by step by repeatedly selecting the next action to take, and tools make this possible.

Now, let’s explore how to build tools and inform the LLM how to use them. We'll also learn how the LLM chooses the appropriate tool for a given task and relays tool executions back to the LLM. Then we'll examine the Model Context Protocol (MCP) by Anthropic, an initiative that standardizes the development and use of tools, as shown in figure 3.1.

Figure 3.1 Book structure overview - Chapter 3 in focus.

3.1 LLM tools

3.1.1 Why do we need LLM tools?

3.1.2 Types of LLM tools

3.2 How LLMs use tools

3.2.1 How tool calling works

3.2.2 How can an LLM choose tools

3.2.3 Guidelines for effective tool calling

3.3 Building tools and tool definitions for LLMs

3.3.1 Implementing a web search tool

3.3.2 Converting to tool definitions

3.3.3 End-to-end tool execution

3.3.4 The challenges of custom tools

3.4 MCP: Standardizing tools

3.4.1 The core of MCP: server–client architecture

3.4.2 Hands-on: Running an MCP server

3.4.3 Understanding the MCP client

3.4.4 Hands-on: Implementing an MCP server

3.5 Summary