liveBook · Manning

Chapter 13: Tool use and function calling

What you will learn in chapter 13 of Reinforcement Learning from Human Feedback

The introduction explains why tools expand language-model capabilities, notes that tool use can be trained, and distinguishes tool use from function calling and code execution.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why tools expand language-model capabilities, notes that tool use can be trained, and distinguishes tool use from function calling and code execution.

Key terms: tools, knowledge cutoff, model weights, tool use, RLHF, function calling, code execution, orchestrator, schema

13.1 Tool-use overview

This section explains why language models use external tools, sketches how tool use developed, and identifies ways to evaluate it.

Key terms: external tools, special tokens, endpoint, up-to-date information, code execution, probabilistic, generative nature, tool use, retrieval-augmented generation, APIs, Model Context Protocol (MCP)

13.2 Interweaving tool calls in generation

The section explains how tool calls and tool outputs are interleaved with model generation, and what training must teach a model to do in that token flow.

Key terms: tool call, tool outputs, autoregressively generated tokens, orchestration loop, function calling, system prompt, tools, arguments, tool use, code execution

13.3 Multistep tool reasoning

This section explains how multistep tool reasoning alternates reasoning with tool actions to gather information and reach an answer.

Key terms: multistep tool reasoning, interleaved thinking, think-tool-think-tool pattern, ReAct, reasoning traces, task-specific actions

13.4 Model Context Protocol

This section explains how MCP standardizes the connection between language models and external data and tools, and identifies the roles of its main components.

Key terms: Model Context Protocol, MCP, JSON schema, JSON-RPC 2.0, resources, prompts, tools, MCP servers, MCP clients, hosts

13.5 Implementation details

This section explains implementation choices for tool-use models and how tool-use behavior is developed through post-training.

Key terms: JSON, Python code, multiturn formatting, chat templates, token streams, masking tool outputs, training loss, prompt masking, schema conformance, constrained decoding

13.6 Summary

Concepts explained in this chapter

← Chapter 12: Synthetic data Chapter 14: Over-optimization →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.