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

# Update tool source



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/cerca/openapi.documented.yml put /fleets/{fleetId}/tools/{sourceId}
openapi: 3.1.0
info:
  description: API-key accessible routes for Cerca agents.
  title: Cerca API
  version: 0.0.0
servers:
  - url: https://api.cerca.dev
security:
  - bearerAuth: []
paths:
  /fleets/{fleetId}/tools/{sourceId}:
    put:
      tags:
        - Tools
      summary: Update tool source
      parameters:
        - schema:
            type: string
            minLength: 1
            example: fleet_abc123
          required: true
          in: path
          name: fleetId
        - schema:
            type: string
            minLength: 1
            example: toolsrc_abc123
          required: true
          in: path
          name: sourceId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateToolSourceRequest'
      responses:
        '200':
          description: Tool source updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolSource'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Not authorized for this fleet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Fleet or tool source not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Tool source conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Cerca from '@cerca-dev/sdk';


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


            const toolSource = await client.tools.update('fleet_abc123',
            'toolsrc_abc123', {
              auth: { kind: 'none' },
              namespace: 'docs',
              tools: [
                {
                  description: 'Search documents',
                  endpoint: { method: 'GET', url: 'https://docs.example.com/search' },
                  inputSchema: { type: 'bar' },
                  name: 'search',
                },
              ],
              type: 'http',
            });


            console.log(toolSource);
        - lang: Python
          source: |-
            import os
            from cerca import Cerca

            client = Cerca(
                api_key=os.environ.get("CERCA_API_KEY"),  # This is the default and can be omitted
            )
            tool_source = client.tools.update(
                fleet_id="fleet_abc123",
                source_id="toolsrc_abc123",
                auth={
                    "kind": "none"
                },
                namespace="docs",
                tools=[{
                    "description": "Search documents",
                    "endpoint": {
                        "method": "GET",
                        "url": "https://docs.example.com/search",
                    },
                    "input_schema": {
                        "type": "bar"
                    },
                    "name": "search",
                }],
                type="http",
            )
            print(tool_source)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/matrices/cerca-go\"\n\t\"github.com/matrices/cerca-go/option\"\n)\n\nfunc main() {\n\tclient := cercago.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttoolSource, err := client.Tools.Update(\n\t\tcontext.TODO(),\n\t\t\"fleet_abc123\",\n\t\t\"toolsrc_abc123\",\n\t\tcercago.ToolUpdateParams{\n\t\t\tBody: cercago.ToolUpdateParamsBodyUpdateHTTPToolSourceRequest{\n\t\t\t\tAuth: cercago.F[cercago.ToolSourceAuthUnionParam](cercago.NoToolSourceAuthParam{\n\t\t\t\t\tKind: cercago.F(cercago.NoToolSourceAuthKindNone),\n\t\t\t\t}),\n\t\t\t\tNamespace: cercago.F(\"docs\"),\n\t\t\t\tTools: cercago.F([]cercago.HTTPToolDefinitionParam{{\n\t\t\t\t\tDescription: cercago.F(\"Search documents\"),\n\t\t\t\t\tEndpoint: cercago.F(cercago.HTTPEndpointParam{\n\t\t\t\t\t\tMethod: cercago.F(cercago.HTTPEndpointMethodGet),\n\t\t\t\t\t\tURL:    cercago.F(\"https://docs.example.com/search\"),\n\t\t\t\t\t}),\n\t\t\t\t\tInputSchema: cercago.F(map[string]interface{}{\n\t\t\t\t\t\t\"type\": \"bar\",\n\t\t\t\t\t}),\n\t\t\t\t\tName: cercago.F(\"search\"),\n\t\t\t\t}}),\n\t\t\t\tType: cercago.F(cercago.ToolUpdateParamsBodyUpdateHTTPToolSourceRequestTypeHTTP),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", toolSource)\n}\n"
        - lang: Ruby
          source: |-
            require "cerca"

            cerca = Cerca::Client.new(api_key: "My API Key")

            tool_source = cerca.tools.update(
              "fleet_abc123",
              "toolsrc_abc123",
              body: {
                auth: {kind: :none},
                namespace: "docs",
                tools: [
                  {
                    description: "Search documents",
                    endpoint: {method: :GET, url: "https://docs.example.com/search"},
                    inputSchema: {type: "bar"},
                    name: "search"
                  }
                ],
                type: :http
              }
            )

            puts(tool_source)
        - lang: CLI
          source: |-
            cerca tools update \
              --api-key 'My API Key' \
              --fleet-id fleet_abc123 \
              --source-id toolsrc_abc123 \
              --auth '{kind: none}' \
              --namespace docs \
              --tool '{description: Search documents, endpoint: {method: GET, url: https://docs.example.com/search}, inputSchema: {type: bar}, name: search}' \
              --type http \
              --url https://mcp.example.com
components:
  schemas:
    UpdateToolSourceRequest:
      oneOf:
        - type: object
          properties:
            approval:
              $ref: '#/components/schemas/ToolApprovalMode'
            auth:
              $ref: '#/components/schemas/ToolSourceAuth'
            enabled:
              type: boolean
            namespace:
              type: string
              example: docs
            execution:
              $ref: '#/components/schemas/HttpToolExecutionPolicy'
            tools:
              type: array
              items:
                $ref: '#/components/schemas/HttpToolDefinition'
            type:
              type: string
              enum:
                - http
              x-stainless-const: true
          required:
            - auth
            - namespace
            - tools
            - type
          additionalProperties:
            x-stainless-any: true
          title: UpdateHttpToolSourceRequest
          x-stainless-variantName: UpdateHttpToolSourceRequest
        - type: object
          properties:
            approval:
              $ref: '#/components/schemas/ToolApprovalMode'
            auth:
              $ref: '#/components/schemas/ToolSourceAuth'
            enabled:
              type: boolean
            namespace:
              type: string
              example: docs
            execution:
              $ref: '#/components/schemas/McpToolExecutionPolicy'
            type:
              type: string
              enum:
                - mcp
              x-stainless-const: true
            url:
              type: string
              example: https://mcp.example.com
          required:
            - auth
            - namespace
            - type
            - url
          additionalProperties:
            x-stainless-any: true
          title: UpdateMcpToolSourceRequest
          x-stainless-variantName: UpdateMcpToolSourceRequest
      discriminator:
        propertyName: type
    ToolSource:
      oneOf:
        - $ref: '#/components/schemas/HttpToolSource'
        - $ref: '#/components/schemas/McpToolSource'
      discriminator:
        propertyName: type
        mapping:
          http:
            $ref: '#/components/schemas/HttpToolSource'
          mcp:
            $ref: '#/components/schemas/McpToolSource'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code when the API can provide one.
          example: MONTHLY_TOKEN_BUDGET_EXCEEDED
      required:
        - error
    ToolApprovalMode:
      type: string
      enum:
        - always
        - never
    ToolSourceAuth:
      oneOf:
        - $ref: '#/components/schemas/NoToolSourceAuth'
          title: NoToolSourceAuth
          x-stainless-variantName: NoToolSourceAuth
        - $ref: '#/components/schemas/ApiKeyToolSourceAuth'
          title: ApiKeyToolSourceAuth
          x-stainless-variantName: ApiKeyToolSourceAuth
        - $ref: '#/components/schemas/OAuthExchangeToolSourceAuth'
          title: OAuthExchangeToolSourceAuth
          x-stainless-variantName: OAuthExchangeToolSourceAuth
        - $ref: '#/components/schemas/OAuthConnectionToolSourceAuth'
          title: OAuthConnectionToolSourceAuth
          x-stainless-variantName: OAuthConnectionToolSourceAuth
      discriminator:
        propertyName: kind
      description: >-
        Tool source authentication configuration. The `kind` field selects one
        of `none`, `api_key`, `oauth_exchange`, or `oauth_connection`.
      example:
        kind: none
    HttpToolExecutionPolicy:
      type: object
      properties:
        idempotencyKeyHeader:
          type: string
        maxAttempts:
          type: number
        retryMode:
          type: string
          enum:
            - disabled
            - safe_only
            - enabled
        timeoutMs:
          type: number
      description: HTTP tool execution retry and timeout policy.
      example:
        timeoutMs: 10000
        maxAttempts: 3
        retryMode: safe_only
    HttpToolDefinition:
      type: object
      properties:
        approval:
          $ref: '#/components/schemas/ToolApprovalMode'
        description:
          type: string
        endpoint:
          $ref: '#/components/schemas/HttpEndpoint'
        execution:
          $ref: '#/components/schemas/HttpToolExecutionPolicy'
        inputSchema:
          type: object
          description: JSON Schema object describing tool input parameters.
          example:
            type: object
          additionalProperties:
            x-stainless-any: true
        name:
          type: string
          example: search
        response:
          $ref: '#/components/schemas/ResponseNormalizationHint'
      required:
        - description
        - endpoint
        - inputSchema
        - name
      description: Definition for a single HTTP tool exposed by a tool source.
      example:
        name: search
        description: Search documents
        inputSchema:
          type: object
        endpoint:
          method: GET
          url: https://docs.example.com/search
    McpToolExecutionPolicy:
      type: object
      properties:
        discoveryTimeoutMs:
          type: number
        executionTimeoutMs:
          type: number
        maxAttempts:
          type: number
        retryMode:
          type: string
          enum:
            - disabled
            - connect_only
            - enabled
      description: MCP discovery and execution retry/timeout policy.
      example:
        discoveryTimeoutMs: 5000
        executionTimeoutMs: 30000
        maxAttempts: 2
        retryMode: connect_only
    HttpToolSource:
      type: object
      properties:
        approval:
          $ref: '#/components/schemas/ToolApprovalMode'
        auth:
          $ref: '#/components/schemas/ToolSourceAuth'
        createdAt:
          type: string
        enabled:
          type: boolean
        fleetId:
          type: string
        id:
          type: string
        namespace:
          type: string
        updatedAt:
          type: string
        version:
          type: number
        execution:
          $ref: '#/components/schemas/HttpToolExecutionPolicy'
        tools:
          type: array
          items:
            $ref: '#/components/schemas/HttpToolDefinition'
        type:
          type: string
          enum:
            - http
          x-stainless-const: true
      required:
        - auth
        - createdAt
        - enabled
        - fleetId
        - id
        - namespace
        - updatedAt
        - version
        - tools
        - type
    McpToolSource:
      type: object
      properties:
        approval:
          $ref: '#/components/schemas/ToolApprovalMode'
        auth:
          $ref: '#/components/schemas/ToolSourceAuth'
        createdAt:
          type: string
        enabled:
          type: boolean
        fleetId:
          type: string
        id:
          type: string
        namespace:
          type: string
        updatedAt:
          type: string
        version:
          type: number
        execution:
          $ref: '#/components/schemas/McpToolExecutionPolicy'
        type:
          type: string
          enum:
            - mcp
          x-stainless-const: true
        url:
          type: string
      required:
        - auth
        - createdAt
        - enabled
        - fleetId
        - id
        - namespace
        - updatedAt
        - version
        - type
        - url
    NoToolSourceAuth:
      type: object
      properties:
        kind:
          type: string
          enum:
            - none
          x-stainless-const: true
      required:
        - kind
    ApiKeyToolSourceAuth:
      type: object
      properties:
        connectionId:
          type: string
          example: 9f063c59-2775-4614-8a68-22e5f90f92f3
        inject:
          $ref: '#/components/schemas/AuthInjection'
        kind:
          type: string
          enum:
            - api_key
          x-stainless-const: true
      required:
        - connectionId
        - inject
        - kind
    OAuthExchangeToolSourceAuth:
      type: object
      properties:
        exchange:
          $ref: '#/components/schemas/OAuthExchangeConfig'
        inject:
          $ref: '#/components/schemas/AuthInjection'
        kind:
          type: string
          enum:
            - oauth_exchange
          x-stainless-const: true
      required:
        - exchange
        - inject
        - kind
    OAuthConnectionToolSourceAuth:
      type: object
      properties:
        inject:
          $ref: '#/components/schemas/AuthInjection'
        kind:
          type: string
          enum:
            - oauth_connection
          x-stainless-const: true
        provider:
          type: string
          example: google
        requiredScopes:
          type: array
          items:
            type: string
      required:
        - kind
        - provider
    HttpEndpoint:
      type: object
      properties:
        body:
          type: string
          enum:
            - json_params
          x-stainless-const: true
        headers:
          type: object
          additionalProperties:
            type: string
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
        path:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ToolParamReference'
        query:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ToolParamReference'
        url:
          type: string
          example: https://docs.example.com/search
      required:
        - method
        - url
      description: HTTP endpoint invoked when the tool is called.
    ResponseNormalizationHint:
      type: object
      properties:
        mode:
          type: string
          enum:
            - auto
            - json
            - markdown
            - blob
      required:
        - mode
      description: How the HTTP response should be normalized for the agent.
    AuthInjection:
      oneOf:
        - $ref: '#/components/schemas/HeaderAuthInjection'
          title: HeaderAuthInjection
          x-stainless-variantName: HeaderAuthInjection
        - $ref: '#/components/schemas/QueryAuthInjection'
          title: QueryAuthInjection
          x-stainless-variantName: QueryAuthInjection
      discriminator:
        propertyName: location
      description: >-
        Where an API key or OAuth access token should be injected into outgoing
        tool-source requests.
    OAuthExchangeConfig:
      oneOf:
        - $ref: '#/components/schemas/ClientCredentialsOAuthExchange'
          title: ClientCredentialsOAuthExchange
          x-stainless-variantName: ClientCredentialsOAuthExchange
        - $ref: '#/components/schemas/JwtBearerOAuthExchange'
          title: JwtBearerOAuthExchange
          x-stainless-variantName: JwtBearerOAuthExchange
      discriminator:
        propertyName: grantType
      description: >-
        Source-owned OAuth exchange configuration. Public schemas use connection
        IDs for stored client secrets and assertions.
    ToolParamReference:
      type: string
      pattern: ^params\.[A-Za-z0-9_.-]+$
      description: Reference to a named tool input parameter.
      example: params.query
    HeaderAuthInjection:
      type: object
      properties:
        location:
          type: string
          enum:
            - header
          x-stainless-const: true
        name:
          type: string
          example: Authorization
        value:
          type: string
          description: >-
            Optional value template. For OAuth connection auth, use values such
            as `Bearer ${token}`.
          example: Bearer ${token}
      required:
        - location
        - name
    QueryAuthInjection:
      type: object
      properties:
        location:
          type: string
          enum:
            - query
          x-stainless-const: true
        name:
          type: string
          example: api_key
      required:
        - location
        - name
    ClientCredentialsOAuthExchange:
      type: object
      properties:
        audience:
          type: string
        clientId:
          type: string
          example: client_abc123
        clientSecretConnectionId:
          type: string
          example: 9f063c59-2775-4614-8a68-22e5f90f92f3
        extraParams:
          type: object
          additionalProperties:
            type: string
        grantType:
          type: string
          enum:
            - client_credentials
          x-stainless-const: true
        scopes:
          type: array
          items:
            type: string
        tokenUrl:
          type: string
          example: https://auth.example.com/oauth/token
      required:
        - clientId
        - clientSecretConnectionId
        - grantType
        - tokenUrl
    JwtBearerOAuthExchange:
      type: object
      properties:
        assertionConnectionId:
          type: string
          example: 9f063c59-2775-4614-8a68-22e5f90f92f3
        audience:
          type: string
          example: https://auth.example.com/oauth/token
        extraParams:
          type: object
          additionalProperties:
            type: string
        grantType:
          type: string
          enum:
            - jwt_bearer
          x-stainless-const: true
        issuer:
          type: string
          example: service-account@example.com
        scopes:
          type: array
          items:
            type: string
        subject:
          type: string
        tokenUrl:
          type: string
          example: https://auth.example.com/oauth/token
      required:
        - assertionConnectionId
        - audience
        - grantType
        - issuer
        - tokenUrl
  securitySchemes:
    bearerAuth:
      bearerFormat: Cerca API key
      scheme: bearer
      type: http

````