Loading...
    • 개발자 가이드
    • API 레퍼런스
    • MCP
    • 리소스
    • 릴리스 노트
    Search...
    ⌘K
    시작하기
    Claude 소개빠른 시작
    모델 및 가격
    모델 개요모델 선택Claude 4.6의 새로운 기능마이그레이션 가이드모델 지원 중단가격
    Claude로 구축하기
    기능 개요Messages API 사용중지 사유 처리프롬프트 모범 사례
    컨텍스트 관리
    컨텍스트 윈도우압축컨텍스트 편집
    기능
    프롬프트 캐싱확장 사고적응형 사고노력 수준메시지 스트리밍배치 처리인용다국어 지원토큰 카운팅임베딩비전PDF 지원Files API검색 결과구조화된 출력
    도구
    개요도구 사용 구현 방법세분화된 도구 스트리밍Bash 도구코드 실행 도구프로그래밍 방식 도구 호출컴퓨터 사용 도구텍스트 편집기 도구웹 페치 도구웹 검색 도구메모리 도구도구 검색 도구
    Agent Skills
    개요빠른 시작모범 사례엔터프라이즈용 SkillsAPI로 Skills 사용
    Agent SDK
    개요빠른 시작TypeScript SDKTypeScript V2 (미리보기)Python SDK마이그레이션 가이드
    API에서 MCP
    MCP 커넥터원격 MCP 서버
    서드파티 플랫폼의 Claude
    Amazon BedrockMicrosoft FoundryVertex AI
    프롬프트 엔지니어링
    개요프롬프트 생성기프롬프트 템플릿 사용프롬프트 개선기명확하고 직접적으로 작성예시 사용 (멀티샷 프롬프팅)Claude에게 생각하게 하기 (CoT)XML 태그 사용Claude에게 역할 부여 (시스템 프롬프트)복잡한 프롬프트 연결긴 컨텍스트 팁확장 사고 팁
    테스트 및 평가
    성공 기준 정의테스트 케이스 개발평가 도구 사용지연 시간 줄이기
    가드레일 강화
    환각 줄이기출력 일관성 높이기탈옥 방지스트리밍 거부프롬프트 유출 줄이기Claude 캐릭터 유지
    관리 및 모니터링
    Admin API 개요데이터 상주워크스페이스사용량 및 비용 APIClaude Code Analytics API제로 데이터 보존
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    도구

    Claude를 활용한 도구 사용

    Claude는 도구 및 함수와 상호작용할 수 있어, Claude의 기능을 확장하여 더 다양한 작업을 수행할 수 있습니다.

    새로운 강좌를 통해 Claude의 도구 사용을 마스터하는 데 필요한 모든 것을 배워보세요! 이 양식을 사용하여 아이디어와 제안을 계속 공유해 주세요.

    엄격한 도구 사용으로 스키마 적합성 보장

    구조화된 출력은 도구 입력에 대한 보장된 스키마 검증을 제공합니다. 도구 정의에 strict: true를 추가하면 Claude의 도구 호출이 항상 스키마와 정확히 일치하도록 보장할 수 있습니다—더 이상 타입 불일치나 누락된 필드가 없습니다.

    잘못된 도구 매개변수가 실패를 유발할 수 있는 프로덕션 에이전트에 적합합니다. 엄격한 도구 사용을 언제 사용해야 하는지 알아보기 →

    다음은 Messages API를 사용하여 Claude에 도구를 제공하는 방법의 예시입니다:

    curl https://api.anthropic.com/v1/messages \
      -H "content-type: application/json" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -d '{
        "model": "claude-opus-4-6",
        "max_tokens": 1024,
        "tools": [
          {
            "name": "get_weather",
            "description": "Get the current weather in a given location",
            "input_schema": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and state, e.g. San Francisco, CA"
                }
              },
              "required": ["location"]
            }
          }
        ],
        "messages": [
          {
            "role": "user",
            "content": "What is the weather like in San Francisco?"
          }
        ]
      }'

    도구 사용 작동 방식

    Claude는 두 가지 유형의 도구를 지원합니다:

    1. 클라이언트 도구: 사용자의 시스템에서 실행되는 도구로, 다음을 포함합니다:

      • 사용자가 직접 생성하고 구현하는 사용자 정의 커스텀 도구
      • 컴퓨터 사용 및 텍스트 편집기와 같이 클라이언트 구현이 필요한 Anthropic 정의 도구
    2. 서버 도구: 웹 검색 및 웹 가져오기 도구와 같이 Anthropic 서버에서 실행되는 도구입니다. 이러한 도구는 API 요청에 지정해야 하지만 사용자 측에서 구현할 필요는 없습니다.

    Anthropic 정의 도구는 모델 버전 간 호환성을 보장하기 위해 버전이 지정된 타입(예: web_search_20250305, text_editor_20250124)을 사용합니다.

    클라이언트 도구

    다음 단계로 Claude와 클라이언트 도구를 통합하세요:

    1. 1

      Claude에 도구와 사용자 프롬프트 제공

      • API 요청에서 이름, 설명, 입력 스키마가 포함된 클라이언트 도구를 정의합니다.
      • 이러한 도구가 필요할 수 있는 사용자 프롬프트를 포함합니다. 예: "샌프란시스코 날씨가 어때?"
    2. 2

      Claude가 도구 사용을 결정

      • Claude는 사용자의 쿼리에 도움이 될 수 있는 도구가 있는지 평가합니다.
      • 있다면, Claude는 적절한 형식의 도구 사용 요청을 구성합니다.
      • 클라이언트 도구의 경우, API 응답에 stop_reason이 tool_use로 설정되어 Claude의 의도를 알립니다.
    3. 3

      도구 실행 및 결과 반환

      • Claude의 요청에서 도구 이름과 입력을 추출합니다
      • 시스템에서 도구 코드를 실행합니다
      • tool_result 콘텐츠 블록이 포함된 새 user 메시지로 결과를 반환합니다
    4. 4

      Claude가 도구 결과를 사용하여 응답 작성

      • Claude는 도구 결과를 분석하여 원래 사용자 프롬프트에 대한 최종 응답을 작성합니다.

    참고: 3단계와 4단계는 선택 사항입니다. 일부 워크플로에서는 결과를 Claude에 다시 보내지 않고 Claude의 도구 사용 요청(2단계)만으로 충분할 수 있습니다.

    서버 도구

    서버 도구는 다른 워크플로를 따릅니다:

    1. 1

      Claude에 도구와 사용자 프롬프트 제공

      • 웹 검색 및 웹 가져오기와 같은 서버 도구에는 자체 매개변수가 있습니다.
      • 이러한 도구가 필요할 수 있는 사용자 프롬프트를 포함합니다. 예: "AI에 대한 최신 뉴스를 검색해줘" 또는 "이 URL의 콘텐츠를 분석해줘."
    2. 2

      Claude가 서버 도구 실행

      • Claude는 서버 도구가 사용자의 쿼리에 도움이 될 수 있는지 평가합니다.
      • 가능하다면, Claude가 도구를 실행하고 결과가 자동으로 Claude의 응답에 통합됩니다.
    3. 3

      Claude가 서버 도구 결과를 사용하여 응답 작성

      • Claude는 서버 도구 결과를 분석하여 원래 사용자 프롬프트에 대한 최종 응답을 작성합니다.
      • 서버 도구 실행에는 추가적인 사용자 상호작용이 필요하지 않습니다.

    Claude와 MCP 도구 사용

    Model Context Protocol (MCP)을 사용하는 애플리케이션을 구축하는 경우, MCP 서버의 도구를 Claude의 Messages API와 직접 사용할 수 있습니다. MCP 도구 정의는 Claude의 도구 형식과 유사한 스키마 형식을 사용합니다. inputSchema를 input_schema로 이름만 변경하면 됩니다.

    자체 MCP 클라이언트를 구축하고 싶지 않으신가요? MCP 커넥터를 사용하여 클라이언트를 구현하지 않고도 Messages API에서 원격 MCP 서버에 직접 연결하세요.

    MCP 도구를 Claude 형식으로 변환

    MCP 클라이언트를 구축하고 MCP 서버에서 list_tools()를 호출하면, inputSchema 필드가 포함된 도구 정의를 받게 됩니다. 이러한 도구를 Claude와 함께 사용하려면 Claude의 형식으로 변환하세요:

    from mcp import ClientSession
    
    async def get_claude_tools(mcp_session: ClientSession):
        """Convert MCP tools to Claude's tool format."""
        mcp_tools = await mcp_session.list_tools()
    
        claude_tools = []
        for tool in mcp_tools.tools:
            claude_tools.append({
                "name": tool.name,
                "description": tool.description or "",
                "input_schema": tool.inputSchema  # Rename inputSchema to input_schema
            })
    
        return claude_tools

    그런 다음 변환된 도구를 Claude에 전달합니다:

    import anthropic
    
    client = anthropic.Anthropic()
    claude_tools = await get_claude_tools(mcp_session)
    
    response = client.messages.create(
        model="claude-opus-4-6",
        max_tokens=1024,
        tools=claude_tools,
        messages=[{"role": "user", "content": "What tools do you have available?"}]
    )

    Claude가 tool_use 블록으로 응답하면, call_tool()을 사용하여 MCP 서버에서 도구를 실행하고 tool_result 블록으로 결과를 Claude에 반환합니다.

    MCP 클라이언트 구축에 대한 전체 가이드는 MCP 클라이언트 구축을 참조하세요.


    도구 사용 예제

    다양한 도구 사용 패턴과 기법을 보여주는 몇 가지 코드 예제입니다. 간결함을 위해 도구는 단순한 도구이며, 도구 설명은 최상의 성능을 보장하기 위한 이상적인 길이보다 짧습니다.


    가격

    Tool use requests are priced based on:

    1. The total number of input tokens sent to the model (including in the tools parameter)
    2. The number of output tokens generated
    3. For server-side tools, additional usage-based pricing (e.g., web search charges per search performed)

    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:

    • The tools parameter in API requests (tool names, descriptions, and schemas)
    • tool_use content blocks in API requests and responses
    • tool_result content blocks in API requests

    When 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.

    ModelTool choiceTool use system prompt token count
    Claude Opus 4.6auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4.1auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 4auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 3.7 (deprecated)auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Haiku 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Haiku 3.5auto, none
    any, tool
    264 tokens
    340 tokens
    Claude Opus 3 (deprecated)auto, none
    any, tool
    530 tokens
    281 tokens
    Claude Sonnet 3auto, none
    any, tool
    159 tokens
    235 tokens
    Claude Haiku 3auto, none
    any, 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 메트릭의 일부로 입력 및 출력 토큰 수가 모두 출력됩니다.


    다음 단계

    쿡북에서 바로 구현할 수 있는 도구 사용 코드 예제 저장소를 살펴보세요:

    계산기 도구

    정확한 수치 계산을 위해 간단한 계산기 도구를 Claude와 통합하는 방법을 알아보세요.

    고객 서비스 에이전트

    클라이언트 도구를 활용하여 지원을 강화하는 반응형 고객 서비스 봇을 구축하세요.

    JSON 추출기

    Claude와 도구 사용을 통해 비정형 텍스트에서 구조화된 데이터를 추출하는 방법을 확인하세요.

    Was this page helpful?

    • Claude와 MCP 도구 사용
    • MCP 도구를 Claude 형식으로 변환