Script 도구

Script 도구 (Script Tool)

커스텀 셸 스크립트를 이름 있는 도구로 정의하는 방법을 설명해요. 안전하고 범위가 명확한 작업을 설명적인 이름으로 노출할 수 있어요.

출처: 문서

본문

script 도구는 커스텀 셸 스크립트를 이름 있는 도구로 정의하게 해 줘요. 에이전트가 명령을 쓰는 일반 shell 도구와 달리, script 도구는 미리 정의된 명령을 실행해요 — 안전하고 범위가 명확한 작업을 설명적인 이름으로 노출하기에 이상적이죠.

구성

간단한 스크립트

toolsets:
  - type: script
    shell:
      run_tests:
        cmd: task test
        description: Run the project test suite
      lint:
        cmd: task lint
        description: Run the linter

파라미터가 있는 스크립트

${param} 보간과 JSON Schema로 타입이 있는 인수를 정의하세요:

toolsets:
  - type: script
    shell:
      deploy:
        cmd: ./scripts/deploy.sh ${env}
        description: Deploy to an environment
        args:
          env:
            type: string
            enum: [staging, production]
        required: [env]

속성

속성 타입 설명
shell.<name>.cmd string 실행할 셸 명령(${arg} 보간 지원)
shell.<name>.description string 모델에 보이는 설명
shell.<name>.args object 파라미터 정의(JSON Schema 속성)
shell.<name>.required array 필수 파라미터 이름
shell.<name>.env object 이 스크립트용 환경 변수
shell.<name>.working_dir string 스크립트 실행용 작업 디렉터리

팁 Script vs Shell 에이전트가 임의 명령을 실행해야 할 때는 shell 도구를 사용하세요. 특정 미리 정의된 작업을 명확한 이름과 타입 있는 파라미터로 노출하고 싶을 때는 script 도구를 사용하세요 — 에이전트에게 자유는 덜 주지만 안전은 더 줍니다.

더 알아보기 (Learn more)