4 Tools in AI agents
This chapter covers
- Tools to interact with external systems in AI agents.
- Function calling to invoke APIs, services, and code.
- The command line interface (CLI) for direct environment interaction.
- Standard protocols for AI agents.
- The model context protocol (MCP) for discoverable tools.
Chapters 2 and 3 examined how instructions and external knowledge shape what an LLM knows and how it responds. This chapter focuses on tools, an additional source of context that enables agentic behavior. Tools allow AI agents to act in the external world by invoking APIs, running code, or interacting with files and services. This chapter covers three paradigms for tool use in AI agents: function calling, the command-line interface (CLI), and the model context protocol (MCP).
4.1 Tools
Tools are a fundamental mechanism for transforming an LLM into a context-aware AI agent. While a model can reason over text using its internal knowledge and the content of its context window, it has no inherent access to live data, user-specific systems, or the ability to act in the external world. Tools bridge this gap by allowing an AI agent to execute actions and observe their outcomes, continuously reshaping the agent’s operational context [19].