> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roark.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a tool

> Replaces the tool: its name, scope, inputs, description, grading hints and runtime. A field left out is cleared, so omitting agentId makes the tool project-wide. A change declares a new version; agent versions pinned to an older one keep it.



## OpenAPI

````yaml /api-reference/openapi.documented.json put /v1/tool/{toolId}
openapi: 3.1.0
info:
  title: Roark Analytics API
  description: >-
    The Roark Analytics API gives you access to the same API that powers the
    award winning Roark Analytics platform.
  version: 1.0.0
servers:
  - description: Production
    url: https://api.roark.ai
security:
  - Bearer: []
tags:
  - name: Agent
  - name: Agent Endpoint
  - name: Tool
  - name: Phone Number
  - name: Call
  - name: Chat
  - name: Metric
  - name: Metric Policy
  - name: Metric Collection Job
  - name: Customer Flow
  - name: Customer Flow Edge Case
  - name: Simulation
  - name: Simulation Persona
  - name: Simulation Environment
  - name: Simulation Scenario
  - name: Simulation Run Plan
  - name: Simulation Template
  - name: Simulation Run Plan Job
  - name: Simulation Job
  - name: HTTP Request Definition
  - name: Webhook
  - name: Issue
  - name: Autoimprove
  - name: Agent Config
  - name: Knowledge Base
  - name: Config
  - name: Organization Project
  - name: Organization Project Member
  - name: Organization Project API Key
  - name: Organization Config
  - name: CLI Auth
  - name: Me
  - name: Project
  - name: Usage
  - name: Analytics
  - name: Dashboard
  - name: Live Report
  - name: Benchmark
  - name: Health
  - name: Prospect Simulation
paths:
  /v1/tool/{toolId}:
    put:
      tags:
        - Tool
      summary: Update a tool
      description: >-
        Replaces the tool: its name, scope, inputs, description, grading hints
        and runtime. A field left out is cleared, so omitting agentId makes the
        tool project-wide. A change declares a new version; agent versions
        pinned to an older one keep it.
      operationId: putV1ToolByToolId
      parameters:
        - in: path
          name: toolId
          schema:
            type: string
            format: uuid
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolBody'
      responses:
        '200':
          description: The tool
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolSingleResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Validation error
              example:
                type: validation
                code: invalid_parameter
                message: The request was invalid
                param: email
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Authentication error
              example:
                type: authentication
                code: unauthorized
                message: Authentication required
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Not found error
              example:
                type: not_found
                code: resource_not_found
                message: The requested resource could not be found
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Conflict error
              example:
                type: conflict
                code: resource_in_use
                message: The resource is in use and cannot be deleted
          description: Conflict
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Server error
              example:
                type: internal
                code: internal_error
                message: Internal server error
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Roark from '@roarkanalytics/sdk';


            const client = new Roark({
              bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
            });


            const tool = await
            client.tool.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
              description: 'x',
              name: 'book_appointment',
            });


            console.log(tool.data);
        - lang: Python
          source: |-
            import os
            from roark_analytics import Roark

            client = Roark(
                bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"),  # This is the default and can be omitted
            )
            tool = client.tool.update(
                tool_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                description="x",
                name="book_appointment",
            )
            print(tool.data)
components:
  schemas:
    ToolBody:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 64
          example: book_appointment
        description:
          type: string
          minLength: 1
          maxLength: 1024
          description: When the agent should use the tool
        agentId:
          type:
            - string
            - 'null'
          format: uuid
        inputs:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                minLength: 1
                maxLength: 64
                example: date
              type:
                type: string
                enum:
                  - string
                  - number
                  - boolean
              description:
                type: string
                maxLength: 1024
              required:
                type: boolean
                default: false
            required:
              - name
              - type
          maxItems: 32
          default: []
        invocationCriteria:
          type:
            - string
            - 'null'
        expectedResult:
          type:
            - string
            - 'null'
        runtime:
          type:
            - object
            - 'null'
          properties:
            request:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                  maxLength: 2048
                method:
                  type: string
                  enum:
                    - POST
                    - PUT
                    - PATCH
                    - GET
                    - DELETE
                  default: POST
                headers:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 128
                        example: X-Api-Version
                      value:
                        type: string
                        maxLength: 1024
                        example: '2026-10-01'
                    required:
                      - name
                      - value
                  maxItems: 32
                  default: []
                body:
                  type:
                    - string
                    - 'null'
                  minLength: 1
                  maxLength: 16000
                timeoutMs:
                  type:
                    - integer
                    - 'null'
                  minimum: 1000
                  maximum: 30000
              required:
                - url
            changesData:
              type: boolean
              default: false
            responseFields:
              type:
                - array
                - 'null'
              items:
                type: string
                minLength: 1
                maxLength: 256
              minItems: 1
              maxItems: 32
            messages:
              type: object
              properties:
                before:
                  type:
                    - string
                    - 'null'
                  maxLength: 500
                slow:
                  type:
                    - string
                    - 'null'
                  maxLength: 500
                failure:
                  type:
                    - string
                    - 'null'
                  maxLength: 500
          required:
            - request
          description: Omit or null for a tool that is only graded
      required:
        - name
        - description
    ToolSingleResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ToolResponse'
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - validation
            - authentication
            - forbidden
            - not_found
            - conflict
            - payment_required
            - rate_limit
            - internal
          description: The error type category
          examples:
            - validation
            - authentication
        code:
          type: string
          description: Machine-readable error code identifier
          examples:
            - invalid_parameter
            - missing_required_field
            - unauthorized
        message:
          type: string
          description: Human-readable error message
          examples:
            - The request was invalid
            - Authentication required
        param:
          type: string
          description: The parameter that caused the error (if applicable)
          examples:
            - email
            - user_id
        details:
          description: Additional error context information
      required:
        - type
        - code
        - message
    ToolResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: book_appointment
        source:
          type: string
          enum:
            - CUSTOM
            - SYSTEM
          description: SYSTEM for a built-in tool every project can attach
        systemKey:
          type:
            - string
            - 'null'
          description: The stable key of a built-in tool, such as dtmf
        agentId:
          type:
            - string
            - 'null'
          format: uuid
          description: The agent the tool is scoped to; null for the project
        version:
          type:
            - integer
            - 'null'
          description: The latest version; null before any is declared
        description:
          type:
            - string
            - 'null'
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/ToolInput'
        invocationCriteria:
          type:
            - string
            - 'null'
          description: When the agent should call it, for grading
        expectedResult:
          type:
            - string
            - 'null'
          description: How it should handle the result, for grading
        runtime:
          oneOf:
            - $ref: '#/components/schemas/ToolRuntime'
            - type: 'null'
          description: Null for a tool that is only graded
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - name
        - source
        - systemKey
        - agentId
        - version
        - description
        - inputs
        - invocationCriteria
        - expectedResult
        - runtime
        - createdAt
        - updatedAt
    ToolInput:
      type: object
      properties:
        name:
          type: string
          description: The input name, as the agent passes it
          example: date
        type:
          type: string
          enum:
            - string
            - number
            - boolean
          description: string, number or boolean
        description:
          type:
            - string
            - 'null'
          description: What the input is, so the agent fills it in right
          example: ISO date
        required:
          type: boolean
          description: The agent must pass it
      required:
        - name
        - type
        - description
        - required
    ToolRuntime:
      type: object
      properties:
        request:
          $ref: '#/components/schemas/ToolRequest'
        changesData:
          type: boolean
          description: >-
            The tool books, cancels or sends something: its call is not
            abandoned when the caller interrupts, and each request carries an
            Idempotency-Key.
        responseFields:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Dot paths into the JSON response the agent is given. Null gives it
            the whole response.
        messages:
          $ref: '#/components/schemas/ToolMessages'
      required:
        - request
        - changesData
        - responseFields
        - messages
      description: What a hosted agent sends and says when it calls the tool
    ToolRequest:
      type: object
      properties:
        url:
          type: string
          description: >-
            https URL. Placeholders {{args.<input>}} and {{conversation.*}} (id,
            direction, modality, agentNumber, customerNumber, startedAt) may
            appear in the path and query.
          example: https://api.example.com/bookings
        method:
          type: string
          enum:
            - POST
            - PUT
            - PATCH
            - GET
            - DELETE
        headers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                minLength: 1
                maxLength: 128
                example: X-Api-Version
              value:
                type: string
                maxLength: 1024
                example: '2026-10-01'
            required:
              - name
              - value
        body:
          type:
            - string
            - 'null'
          description: >-
            JSON body template. Null sends the inputs as the body (POST, PUT,
            PATCH) or the query (GET, DELETE).
        timeoutMs:
          type:
            - integer
            - 'null'
          description: How long the agent waits, 1000 to 30000 ms
      required:
        - url
        - method
        - headers
        - body
        - timeoutMs
    ToolMessages:
      type: object
      properties:
        before:
          type:
            - string
            - 'null'
          description: Said as the request goes out
        slow:
          type:
            - string
            - 'null'
          description: Said once if the request is slow
        failure:
          type:
            - string
            - 'null'
          description: Given to the agent to say when the request fails
      required:
        - before
        - slow
        - failure
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.