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

# Update a tool



## OpenAPI

````yaml /openapi.yaml put /tools/{toolId}
openapi: 3.0.0
info:
  title: superglue AI API
  version: 1.0.0
  description: API for running superglue AI tools
  contact:
    name: superglue AI Support
    email: stefan@superglue.ai
servers:
  - url: https://api.superglue.ai/v1
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /tools/{toolId}:
    put:
      tags:
        - Tools
      summary: Update a tool
      operationId: updateTool
      parameters:
        - name: toolId
          in: path
          required: true
          schema:
            type: string
          example: 550e8400-e29b-41d4-a716-446655440000
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateToolRequest'
      responses:
        '200':
          description: Tool updated successfully
          headers:
            X-Trace-Id:
              schema:
                type: string
              description: Request trace ID for debugging and log correlation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tool'
        '400':
          description: >
            Validation error. The update would result in an invalid tool
            configuration

            (e.g., removing all steps without providing an outputTransform).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Tool not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UpdateToolRequest:
      type: object
      description: >-
        Request body for updating an existing tool. All fields are optional —
        only provided fields are updated.
      properties:
        name:
          type: string
          description: Human-readable name for the tool
          example: Web Search v2
        steps:
          type: array
          description: Ordered execution steps (replaces all existing steps)
          items:
            $ref: '#/components/schemas/ToolStep'
        instruction:
          type: string
          description: Human-readable instruction describing what the tool does
        inputSchema:
          type: object
          description: JSON Schema for tool inputs
        outputSchema:
          type: object
          description: JSON Schema for tool outputs
        outputTransform:
          type: string
          description: >-
            JavaScript function for final output transformation. Format:
            (sourceData) => expression
        folder:
          type: string
          description: Folder path for organizing tools
        archived:
          type: boolean
          description: >-
            Set to true to archive the tool (prevents execution and hides from
            default listing)
    Tool:
      type: object
      description: >-
        A multi-step workflow tool that executes one or more protocol-specific
        operations
      required:
        - id
        - steps
      properties:
        id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          example: Web Search
        version:
          type: string
          description: Semantic version string (major.minor.patch)
          example: 2.1.0
          pattern: ^\d+\.\d+\.\d+$
        instruction:
          type: string
          description: Human-readable instruction describing what the tool does
          example: Search the web for the given query and return relevant results
        inputSchema:
          type: object
          description: JSON Schema for tool inputs
          example:
            type: object
            properties:
              query:
                type: string
              maxResults:
                type: integer
                default: 10
            required:
              - query
        outputSchema:
          type: object
          description: JSON Schema for tool outputs (after transformations applied)
        steps:
          type: array
          description: Ordered execution steps that make up this tool
          minItems: 1
          items:
            $ref: '#/components/schemas/ToolStep'
        outputTransform:
          type: string
          description: |
            JavaScript function for final output transformation.
            Format: (sourceData) => expression
          example: >-
            (sourceData) => sourceData.map(item => ({ id: item.id, title:
            item.name }))
        folder:
          type: string
          description: Folder path for organizing tools
          example: integrations/payments
        archived:
          type: boolean
          description: >-
            Whether this tool is archived (if so, it will not be listed in the
            UI and cannot be run)
          default: false
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              example: Invalid input parameters
    ToolStep:
      type: object
      description: >
        A single execution step containing either a request configuration (API
        call)

        or a transform configuration (data transformation).
      required:
        - id
        - config
      properties:
        id:
          type: string
          description: Unique identifier for this step
          example: 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
        config:
          $ref: '#/components/schemas/StepConfig'
        instruction:
          type: string
          description: Human-readable instruction describing what this step does
          example: Fetch user details from the API
        modify:
          type: boolean
          description: Whether this step modifies data on the system it operates on
          default: false
        dataSelector:
          type: string
          description: |
            JavaScript function to select data for loop execution.
            Format: (sourceData) => expression
          example: (sourceData) => sourceData.data.items
        failureBehavior:
          type: string
          enum:
            - fail
            - continue
          description: >-
            How to handle step failures (fail stops execution, continue proceeds
            to next step)
          default: fail
    StepConfig:
      oneOf:
        - $ref: '#/components/schemas/RequestStepConfig'
        - $ref: '#/components/schemas/TransformStepConfig'
      discriminator:
        propertyName: type
        mapping:
          request:
            $ref: '#/components/schemas/RequestStepConfig'
          transform:
            $ref: '#/components/schemas/TransformStepConfig'
    RequestStepConfig:
      type: object
      description: >
        Configuration for a request step. Protocol is detected from URL scheme:

        - HTTP/HTTPS: Standard REST API calls with query params, headers, body

        - Postgres: postgres:// or postgresql:// URLs, body contains SQL query

        - FTP/SFTP: ftp://, ftps://, or sftp:// URLs, body contains operation
        details
      required:
        - url
        - method
      properties:
        type:
          type: string
          enum:
            - request
          description: Optional type discriminator (defaults to request)
        url:
          type: string
          description: |
            Full URL including protocol. Examples:
            - HTTP: https://api.example.com/search
            - Postgres: postgres://user:pass@host:5432/database
            - FTP: ftp://user:pass@host:21/path
            - SFTP: sftp://user:pass@host:22/path
          example: https://api.example.com/search
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
            - HEAD
            - OPTIONS
          description: HTTP method. For non-HTTP protocols, use POST.
          example: GET
        queryParams:
          type: object
          description: >-
            URL query parameters (HTTP only). Supports template expressions with
            <<(sourceData) => ...>> syntax.
          additionalProperties: true
          example:
            q: <<(sourceData) => sourceData.query>>
            limit: 10
        headers:
          type: object
          description: >-
            HTTP headers (HTTP only). Supports template expressions with
            <<(sourceData) => ...>> syntax.
          additionalProperties: true
          example:
            Content-Type: application/json
            Authorization: Bearer <<(sourceData) => sourceData.credentials.apiKey>>
        body:
          type: string
          description: >
            Request body (protocol-specific). Supports template expressions with
            <<(sourceData) => ...>> syntax.


            HTTP: Any content (JSON, XML, form data, etc.)

            Example: '{"query": "<<(sourceData) => sourceData.query>>"}'


            Postgres: JSON with query and optional params

            Example: '{"query": "SELECT * FROM users WHERE id = $1", "params":
            ["<<(sourceData) => sourceData.userId>>"]}'


            FTP/SFTP: JSON with operation, path, and optional content

            Example: '{"operation": "get", "path": "/data/file.csv"}'

            Example: '{"operation": "list", "path": "/data"}'

            Example: '{"operation": "put", "path": "/data/file.txt", "content":
            "<<(sourceData) => sourceData.fileContent>>"}'
          example: '{"query": "<<(sourceData) => sourceData.query>>"}'
        pagination:
          $ref: '#/components/schemas/Pagination'
        systemId:
          type: string
          description: System to use for stored credentials and documentation
          example: 3f7c8d9e-1a2b-4c5d-8e9f-0a1b2c3d4e5f
    TransformStepConfig:
      type: object
      description: >
        Configuration for a transform step. Transform steps execute JavaScript
        code

        to reshape data between request steps without making external API calls.
      required:
        - type
        - transformCode
      properties:
        type:
          type: string
          enum:
            - transform
          description: Type discriminator for transform steps
        transformCode:
          type: string
          description: |
            JavaScript function that transforms sourceData.
            Format: (sourceData) => transformedData
            The function receives all previous step results and payload data.
          example: >-
            (sourceData) => sourceData.getUsers.data.map(u => ({ id: u.id, name:
            u.fullName }))
    Pagination:
      type: object
      description: >-
        Pagination configuration (HTTP/HTTPS only, not applicable to
        Postgres/FTP)
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - offsetBased
            - pageBased
            - cursorBased
            - disabled
          example: cursorBased
        pageSize:
          type: string
          description: >-
            Number of items per page. Becomes available as <<(sourceData) =>
            sourceData.limit>> in request templates.
          example: '50'
        cursorPath:
          type: string
          description: >-
            JSONPath to extract next page cursor from response body (e.g.
            "meta.next_cursor" for {meta:{next_cursor:"abc"}})
          example: meta.next_cursor
        stopCondition:
          type: string
          description: >
            JavaScript function to determine when to stop pagination. Format:
            (response, pageInfo) => boolean

            - response: Object with {data: ..., headers: ...} - access response
            body via response.data

            - pageInfo: Object with {page: number, offset: number, cursor: any,
            totalFetched: number}

            - Return true to STOP pagination, false to continue
          example: (response, pageInfo) => !response.data.pagination.has_more
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: Static API Key
      description: >
        Static API key authentication using Bearer token scheme.

        Include your API key in the Authorization header: `Authorization: Bearer
        YOUR_API_KEY`


        Alternatively, you can use the `token` query parameter to authenticate.


        API keys can be generated in your superglue dashboard.

````