
How AI Agents Use Tools: Function Calling & MCP
Stanford professor Diyi Yang covers how large language models learn to use external tools in this lecture from CS329Z: Engineering AI Agents. She opens with the "lost in the middle" problem that limits what LLMs can do unaided, then walks through tool-learning methods including Toolformer and ToolkenGPT, and scaling approaches like ToolLLM and Gorilla that let models work with thousands of APIs. The lecture distinguishes REST APIs, function calling, and the Model Context Protocol (MCP) as competing ways to connect models to tools, and surveys evaluation benchmarks such as BFCL, ToolBench, and tau-bench alongside common failure modes in tool use. Delivered as part of a graduate course taught with Michael Ryan and John Yang, the talk is technical and example-driven, aimed at students building or evaluating agentic AI systems rather than general audiences.