Week 3: Tool Use and Function Calling
MCP protocol, OpenAI/Anthropic APIs, tool design
Week 3 of 12
Learning Objectives
- Implement MCP tools using Python SDK
- Compare OpenAI and Anthropic function calling
- Design effective tool schemas
Topics Covered
- Model Context Protocol (MCP)
- OpenAI function calling API
- Anthropic tool use API
- Tool design best practices
Resources
Jupyter Notebooks
Required Readings
| Paper | Authors | Year | Link |
|---|---|---|---|
| Toolformer: Language Models Can Teach Themselves to Use Tools | Schick et al. | 2023 | arXiv |
| Gorilla: Large Language Model Connected with APIs | Patil et al. | 2023 | arXiv |
Reading Guide: Toolformer Paper
Study of self-supervised tool learning in language models
Primary Paper
Toolformer: Language Models Can Teach Themselves to Use Tools
Schick, T., Dwivedi-Yu, J., et al. (2023)
NeurIPS 2023 arXiv
Schick, T., Dwivedi-Yu, J., et al. (2023)
NeurIPS 2023 arXiv
Exercise: Tool Design
Design and implement MCP tools for agent use
Learning Objectives
- Create: Design effective tool schemas
- Apply: Implement MCP tools using Python SDK
- Analyze: Compare OpenAI and Anthropic APIs
Tasks
| Task | Points | Description |
|---|---|---|
| Tool Schema Design | 25 | Design JSON schemas for 3 tools |
| MCP Implementation | 40 | Implement tools using MCP SDK |
| API Comparison | 35 | Compare function calling across providers |
Exercise
Build a multi-tool agent that can:
- Search the web for information
- Perform calculations
- Look up weather data
- Decide which tool to use based on the query
Discussion Questions
- How do OpenAI and Anthropic function calling APIs differ?
- What makes a good tool description?
- How should agents handle tool errors?
Additional Resources
Discussion & Questions
Join the Conversation
Have questions about this week's material? Want to discuss concepts with fellow students?