도구 사용을 통해 Claude는 사용자가 정의한 함수 또는 Anthropic이 제공하는 함수를 호출할 수 있습니다. Claude는 사용자의 요청과 도구의 설명을 기반으로 도구를 호출할 시기를 결정한 후, 애플리케이션이 실행하는(클라이언트 도구) 또는 Anthropic이 실행하는(서버 도구) 구조화된 호출을 반환합니다.
다음은 Anthropic이 실행을 처리하는 서버 도구를 사용한 가장 간단한 예입니다:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
tools=[{"type": "web_search_20260209", "name": "web_search"}],
messages=[{"role": "user", "content": "What's the latest on the Mars rover?"}],
)
print(response.content)도구는 주로 코드가 실행되는 위치에 따라 다릅니다. 클라이언트 도구(사용자 정의 도구 및 bash, text_editor와 같은 Anthropic 스키마 도구 포함)는 애플리케이션에서 실행됩니다: Claude는 stop_reason: "tool_use"와 하나 이상의 tool_use 블록으로 응답하고, 코드가 작업을 실행한 후 tool_result를 다시 보냅니다. 서버 도구(web_search, code_execution, web_fetch, tool_search)는 Anthropic의 인프라에서 실행됩니다: 실행을 처리하지 않고도 결과를 직접 볼 수 있습니다.
에이전트 루프를 포함한 전체 개념 모델과 각 접근 방식을 선택할 시기에 대해서는 도구 사용의 작동 방식을 참조하세요.
MCP 서버에 연결하려면 MCP 커넥터를 참조하세요. 자신의 MCP 클라이언트를 구축하려면 modelcontextprotocol.io를 참조하세요.
엄격한 도구 사용으로 스키마 준수 보장
도구 정의에 strict: true를 추가하여 Claude의 도구 호출이 항상 스키마와 정확히 일치하도록 합니다. 엄격한 도구 사용을 참조하세요.
도구 접근은 에이전트에게 제공할 수 있는 가장 높은 영향력의 기본 요소 중 하나입니다. LAB-Bench FigQA(과학 그림 해석) 및 SWE-bench(실제 소프트웨어 엔지니어링)와 같은 벤치마크에서 기본 도구를 추가하기만 해도 인간 전문가 기준선을 능가하는 경우가 많으며, 비정상적인 능력 향상을 가져옵니다.
완전한 실습 안내는 튜토리얼을 참조하세요. 개별 개념의 참조 예제는 도구 정의 및 도구 호출 처리를 참조하세요.
Tool use requests are priced based on:
tools parameter)Client-side tools are priced the same as any other Claude API request, while server-side tools may incur additional charges based on their specific usage.
The additional tokens from tool use come from:
tools parameter in API requests (tool names, descriptions, and schemas)tool_use content blocks in API requests and responsestool_result content blocks in API requestsWhen you use tools, we also automatically include a special system prompt for the model which enables tool use. The number of tool use tokens required for each model are listed below (excluding the additional tokens listed above). Note that the table assumes at least 1 tool is provided. If no tools are provided, then a tool choice of none uses 0 additional system prompt tokens.
| Model | Tool choice | Tool use system prompt token count |
|---|---|---|
| Claude Opus 4.7 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Opus 4.6 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Opus 4.5 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Opus 4.1 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Opus 4 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Sonnet 4.6 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Sonnet 4.5 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Sonnet 4 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Sonnet 3.7 (deprecated) | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Haiku 4.5 | auto, noneany, tool | 346 tokens 313 tokens |
| Claude Haiku 3.5 | auto, noneany, tool | 264 tokens 340 tokens |
| Claude Opus 3 (deprecated) | auto, noneany, tool | 530 tokens 281 tokens |
| Claude Sonnet 3 | auto, noneany, tool | 159 tokens 235 tokens |
| Claude Haiku 3 | auto, noneany, tool | 264 tokens 340 tokens |
These token counts are added to your normal input and output tokens to calculate the total cost of a request.
현재 모델별 가격은 모델 개요 표를 참조하세요.
도구 사용 프롬프트를 보낼 때, 다른 API 요청과 마찬가지로 응답은 보고된 usage 메트릭의 일부로 입력 및 출력 토큰 수를 모두 출력합니다.
도구가 실행되는 위치, 루프의 작동 방식, 도구를 사용할 시기.
튜토리얼: 단일 도구 호출에서 프로덕션까지.
Anthropic 제공 도구 및 속성의 디렉토리.
Was this page helpful?