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

# Publish Tool

> Run the publish gates for the draft and, when they all pass, create the next immutable version. If any gate fails, returns 409 with the same PublishResult body, published set to false, and the per-gate check results.



## OpenAPI

````yaml /api-reference/agents/tools.oas.yaml post /v1/agents/tools/{tool_id}/publish
openapi: 3.1.0
info:
  title: SLNG Agent Resources — Tools
  version: 1.0.0
  description: >-
    Public API for organisation tools, MCP servers, Vault entries, and BYOK
    client models.
  contact:
    name: SLNG Support
    email: support@slng.ai
servers:
  - url: https://api.agents.slng.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/agents/tools/{tool_id}/publish:
    post:
      summary: Publish Tool
      description: >-
        Run the publish gates for the draft and, when they all pass, create the
        next immutable version. If any gate fails, returns 409 with the same
        PublishResult body, published set to false, and the per-gate check
        results.
      operationId: publishTool
      parameters:
        - name: tool_id
          in: path
          required: true
          description: >-
            The tool UUID. Curated tools are visible but read-only, and a tool
            owned by another organisation returns 404.
          schema:
            type: string
            format: uuid
            title: Tool Id
      responses:
        '200':
          description: >-
            The publish result. A new immutable version is created and the
            per-gate checks are reported; if a gate fails, the same body is
            returned with a 409 and published set to false.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishResult'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          description: One or more gates failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishResult'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    PublishResult:
      properties:
        published:
          type: boolean
          title: Published
        version_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version Number
        checks:
          $ref: '#/components/schemas/GateStatus'
      type: object
      required:
        - published
        - checks
      title: PublishResult
      description: >-
        Outcome of a publish attempt, with the new version number and per-gate
        checks.
      example:
        published: true
        version_number: 4
        checks:
          static:
            config_valid:
              passed: true
            secrets_exist:
              passed: true
            name_unique:
              passed: true
          green_run:
            passed: true
    GateStatus:
      properties:
        static:
          anyOf:
            - $ref: '#/components/schemas/StaticGate'
            - $ref: '#/components/schemas/TypedStaticGate'
            - type: 'null'
          title: Static
        green_run:
          anyOf:
            - $ref: '#/components/schemas/GreenRun'
            - type: 'null'
        config_valid:
          anyOf:
            - $ref: '#/components/schemas/CheckResult'
            - type: 'null'
        code_environment:
          anyOf:
            - $ref: '#/components/schemas/CheckResult'
            - type: 'null'
        content_current:
          anyOf:
            - $ref: '#/components/schemas/CheckResult'
            - type: 'null'
      type: object
      title: GateStatus
      description: |-
        Gate set is selected by tool_type (V2): data → static + green_run;
        code also reports config_valid; ctx-bound → config_valid ONLY.
    ApiErrorResponse:
      type: object
      required:
        - detail
        - error
      properties:
        detail:
          type: string
        error:
          $ref: '#/components/schemas/ApiErrorDetail'
      description: Standard error envelope returned for a failed request.
      example:
        detail: The tool is attached to an active agent.
        error:
          code: TOOL_DELETE_BLOCKED
          message: The tool is attached to an active agent.
          retryable: false
    StaticGate:
      properties:
        parse:
          $ref: '#/components/schemas/CheckResult'
        models:
          $ref: '#/components/schemas/CheckResult'
        schema:
          $ref: '#/components/schemas/CheckResult'
        secrets_exist:
          $ref: '#/components/schemas/CheckResult'
        name_unique:
          $ref: '#/components/schemas/CheckResult'
      type: object
      required:
        - parse
        - models
        - schema
        - secrets_exist
        - name_unique
      title: Static gate
      description: A publish readiness gate evaluated from static analysis.
    TypedStaticGate:
      properties:
        config_valid:
          $ref: '#/components/schemas/CheckResult'
        secrets_exist:
          $ref: '#/components/schemas/CheckResult'
        name_unique:
          $ref: '#/components/schemas/CheckResult'
      type: object
      required:
        - config_valid
        - secrets_exist
        - name_unique
      title: Typed static gate
      description: A typed publish readiness gate evaluated from static analysis.
    GreenRun:
      properties:
        passed:
          type: boolean
          title: Passed
        proven_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Proven Hash
      type: object
      required:
        - passed
      title: GreenRun
      description: >-
        Result of the green-run gate, with the hash proven by a successful test
        run.
    CheckResult:
      properties:
        passed:
          type: boolean
          title: Passed
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
      type: object
      required:
        - passed
      title: CheckResult
      description: >-
        Result of one publish readiness check, with a pass flag and optional
        detail.
    ApiErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
          example: TOOL_DELETE_BLOCKED
        message:
          type: string
          example: The tool is attached to an active agent.
        request_id:
          type:
            - string
            - 'null'
          example: req_01HZYABCDEF
        retryable:
          type: boolean
          example: false
        fields:
          type: array
          example: []
          items:
            type: object
            additionalProperties: true
      description: >-
        Structured error detail with a stable code, a human-readable message,
        and optional per-field errors.
      example:
        code: TOOL_DELETE_BLOCKED
        message: The tool is attached to an active agent.
        request_id: req_01HZYABCDEF
        retryable: false
        fields: []
  responses:
    UnauthorizedError:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    ForbiddenError:
      description: >-
        The caller cannot perform this operation, or public resource access is
        disabled for the organisation. Disabled access returns code
        PUBLIC_SHARED_RESOURCES_DISABLED with retryable set to false.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    NotFoundError:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    ValidationError:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    RateLimitError:
      description: The organisation's request limit was exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
    InternalServerError:
      description: The operation failed. The response does not expose secret values.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: SLNG API key
      description: Your SLNG consumer API key.

````