Summary audio
No audio recap for this lesson.
Study notes
- Tool Implementation Already Provided: The code for add_duration_to_date_time and set_reminder functions was pre-built in the tools and schemas cell
- Two Schemas Required: Both add_duration_to_date_time_schema and set_reminder_schema must be passed to Claude so it knows these tools exist
- Update run_conversation Function: Add both tool schemas to the list of tools that Claude can access
- Update run_tool Function: Add conditional logic (if/case statements) to check the tool name and call the appropriate function with the tool input arguments
- Tool Function Pattern: Use **tool_input to unpack arguments when calling the actual tool functions
- Scaling is Simple: Once the core framework is built, adding new tools requires only three steps:
- Update the run_tool function with a new case
- Add the tool schema to Claude's available tools
- Implement the actual tool function
- Multi-Step Tool Calls: Claude can chain multiple tool calls together (e. g. , first calculate a date, then use that result to set a reminder)
- Tool Results Flow: User message → Assistant uses tool → Tool results returned → Assistant provides final response, all tracked in conversation history
- Message Structure: Messages can contain multiple blocks (text blocks and tool use blocks) in a single response
Takeaways
- Tool schemas must be passed to Claude so it knows what tools are available
- The run_tool function needs conditional logic to route tool calls to the correct function
- Use **tool_input to unpack arguments when calling tool functions
- Claude can chain multiple tool calls together in sequence
- Adding new tools requires only three steps: update run_tool, add schema to Claude's tools, and implement the function
Flashcards 7 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 6 questions