Files
vibe-coding-cn/skills/claude-cookbooks/references/tool_use.md
T
tukuaiai 5f8b0776e0 refactor: skills 目录扁平化,移除分类子目录
- 将 00-元技能、01-AI工具、02-数据库、03-加密货币、04-开发工具、05-生产力 下的技能移至 skills/ 根目录
- 更新 skills/README.md 使用表格进行说明性分类
- 更新 AGENTS.md 目录结构说明
2026-02-12 01:57:48 +08:00

1.7 KiB

Tool Use with Claude

Source: anthropics/claude-cookbooks/tool_use

Overview

Learn how to integrate Claude with external tools and functions to extend its capabilities.

Key Examples

Customer Service Agent

  • Location: tool_use/customer_service_agent.ipynb
  • Description: Build an intelligent customer service agent using Claude with tool integration
  • Key Concepts: Function calling, state management, conversation flow

Calculator Integration

  • Location: tool_use/calculator_tool.ipynb
  • Description: Integrate external calculation tools with Claude
  • Key Concepts: Tool definitions, parameter passing, result handling

Memory Demo

  • Location: tool_use/memory_demo/
  • Description: Implement persistent memory for Claude conversations
  • Key Concepts: Context management, state persistence

Best Practices

  1. Tool Definition: Define clear, specific tool schemas
  2. Error Handling: Implement robust error handling for tool calls
  3. Validation: Validate tool inputs and outputs
  4. Context: Maintain context across tool interactions

Common Patterns

# Tool definition example
tools = [{
    "name": "calculator",
    "description": "Performs basic arithmetic operations",
    "input_schema": {
        "type": "object",
        "properties": {
            "operation": {"type": "string"},
            "a": {"type": "number"},
            "b": {"type": "number"}
        },
        "required": ["operation", "a", "b"]
    }
}]