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

# Replace body

> Inputs and response fields for replace_body.

This callable is not an HTTP endpoint. Its schemas describe the hosted tool. Direct MCP and tool RPC wrap the same semantic document differently. See the [MCP contract](/reference/mcp-catalog) or [tool RPC contract](/reference/rpc-catalog).


## OpenAPI

````yaml /reference/callables.openapi.json post /callables/replace_body
openapi: 3.1.0
info:
  title: Kast callable reference
  version: '3'
  description: Public compiler-grounded Kast callables for connected agents.
servers: []
security: []
paths:
  /callables/replace_body:
    post:
      summary: replace body
      description: >-
        Replace only the block body of one existing, non-inline named Kotlin
        function selected by an exact Kast symbol reference. Kast plans,
        applies, verifies, and reports a verified receipt or finite failure with
        recovery evidence. The signature and surrounding source are preserved.
      operationId: replace_body
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/replace_bodyRequest'
            examples:
              exactTarget:
                summary: >-
                  Replace the block body of one exact named function returned by
                  Kast.
                value:
                  exactTarget: exact:v5:AAAAAAAAAAAAAAAAAAAAAQ
                  body: '{ return Unit }'
            x-kast-invalidExamples:
              missingBody:
                summary: A replacement body is required.
                value:
                  exactTarget: exact:v5:AAAAAAAAAAAAAAAAAAAAAQ
      responses:
        '200':
          description: >-
            Invocation envelope: completed contains a semantic document;
            rejected contains a boundary diagnostic. A completed invocation may
            still contain a qualified or rejected semantic outcome.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/replace_bodyResponse'
components:
  schemas:
    replace_bodyRequest:
      type: object
      properties:
        exactTarget:
          type: string
          minLength: 1
          maxLength: 1048576
          description: Opaque exact-symbol reference returned by Kast. Copy it unchanged.
        body:
          type: string
          minLength: 1
          maxLength: 1048576
          description: >-
            One complete Kotlin block body, including braces. Syntax errors and
            trailing input are rejected.
      required:
        - exactTarget
        - body
      additionalProperties: false
    replace_bodyResponse:
      anyOf:
        - type: object
          additionalProperties: false
          properties:
            status:
              type: string
              const: completed
              description: Process outcome.
            document:
              anyOf:
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: complete
                    planIdentity:
                      type: string
                    plan:
                      type: object
                      additionalProperties: true
                    application:
                      type: object
                      additionalProperties: true
                  required:
                    - status
                    - planIdentity
                    - plan
                    - application
                  title: complete
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: rejected
                    error:
                      type: object
                      additionalProperties: false
                      properties:
                        code:
                          type: string
                          enum:
                            - PLANNING_REJECTED
                            - AUTHORIZATION_UNAVAILABLE
                            - APPLY_REJECTED
                            - APPLY_UNVERIFIED
                            - RECOVERY_UNAVAILABLE
                        planIdentity:
                          anyOf:
                            - type: string
                            - type: 'null'
                        plan:
                          anyOf:
                            - type: object
                              additionalProperties: true
                            - type: 'null'
                        application:
                          anyOf:
                            - type: object
                              additionalProperties: true
                            - type: 'null'
                        recovery:
                          anyOf:
                            - type: object
                              additionalProperties: true
                            - type: 'null'
                      required:
                        - code
                  required:
                    - status
                    - error
                  title: rejected
          required:
            - status
            - document
          title: completed
        - type: object
          additionalProperties: false
          properties:
            status:
              type: string
              const: rejected
              description: Process outcome.
            diagnostic:
              anyOf:
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: rejected
                      description: Boundary outcome.
                    boundary:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Rejected process boundary.
                    reason:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Closed boundary rejection reason.
                  required:
                    - status
                    - boundary
                    - reason
                  title: rejected
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: rejected
                      description: Boundary outcome.
                    boundary:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Rejected process boundary.
                    reason:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Closed boundary rejection reason.
                    diagnostic:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Usage diagnostic.
                  required:
                    - status
                    - boundary
                    - reason
                    - diagnostic
                  title: rejected
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: rejected
                      description: Boundary outcome.
                    boundary:
                      type: string
                      const: runtime
                      description: Rejected process boundary.
                    reason:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Closed boundary rejection reason.
                    details:
                      anyOf:
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: malformed-document
                              description: Closed failure variant.
                          required:
                            - type
                          title: malformed-document
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: non-canonical-document
                              description: Closed failure variant.
                          required:
                            - type
                          title: non-canonical-document
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: unsupported-schema
                              description: Closed failure variant.
                          required:
                            - type
                          title: unsupported-schema
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: unsupported-host-kind
                              description: Closed failure variant.
                          required:
                            - type
                          title: unsupported-host-kind
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: unsupported-framing
                              description: Closed failure variant.
                          required:
                            - type
                          title: unsupported-framing
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: invalid-canonical-root
                              description: Closed failure variant.
                            failure:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                          required:
                            - type
                            - failure
                          title: invalid-canonical-root
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: invalid-socket-path
                              description: Closed failure variant.
                            failure:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                          required:
                            - type
                            - failure
                          title: invalid-socket-path
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: invalid-process-id
                              description: Closed failure variant.
                            failure:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                          required:
                            - type
                            - failure
                          title: invalid-process-id
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: invalid-runtime-epoch
                              description: Closed failure variant.
                            failure:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                          required:
                            - type
                            - failure
                          title: invalid-runtime-epoch
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: compatibility-rejected
                              description: Descriptor failure variant.
                            failure:
                              anyOf:
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: malformed
                                      description: Compatibility failure.
                                    field:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Rejected compatibility field.
                                    syntax:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Closed syntax failure.
                                  required:
                                    - type
                                    - field
                                    - syntax
                                  title: malformed
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: mismatch
                                      description: Compatibility failure.
                                    field:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Mismatched compatibility field.
                                    expected:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Expected identity.
                                    observed:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Observed identity.
                                  required:
                                    - type
                                    - field
                                    - expected
                                    - observed
                                  title: mismatch
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: capability-set-mismatch
                                      description: Compatibility failure.
                                    field:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Mismatched capability field.
                                    expected:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        maxLength: 1048576
                                        description: Expected operation.
                                    observed:
                                      type: array
                                      items:
                                        type: string
                                        minLength: 1
                                        maxLength: 1048576
                                        description: Observed operation.
                                  required:
                                    - type
                                    - field
                                    - expected
                                    - observed
                                  title: capability-set-mismatch
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: unknown-capability
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: unknown-capability
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: unsupported-capability
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: unsupported-capability
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: duplicate-capability
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: duplicate-capability
                          required:
                            - type
                            - failure
                          title: compatibility-rejected
                        - type: object
                          additionalProperties: false
                          properties:
                            type:
                              type: string
                              const: hosted-capabilities-rejected
                              description: Descriptor failure variant.
                            failure:
                              anyOf:
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: malformed-operation-id
                                      description: Closed failure variant.
                                    failure:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - failure
                                  title: malformed-operation-id
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: unknown-operation
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: unknown-operation
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: unsupported-intent
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: unsupported-intent
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: duplicate-operation
                                      description: Closed failure variant.
                                    operationId:
                                      $ref: >-
                                        #/components/schemas/replace_bodyResponse_finiteFailureEvidence
                                  required:
                                    - type
                                    - operationId
                                  title: duplicate-operation
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: duplicate-intent
                                      description: Hosted-capability failure.
                                    operationId:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Canonical operation identity.
                                    intent:
                                      type: string
                                      minLength: 1
                                      maxLength: 1048576
                                      description: Duplicate hosted intent.
                                  required:
                                    - type
                                    - operationId
                                    - intent
                                  title: duplicate-intent
                                - type: object
                                  additionalProperties: false
                                  properties:
                                    type:
                                      type: string
                                      const: canonical-projection-mismatch
                                      description: Closed failure variant.
                                  required:
                                    - type
                                  title: canonical-projection-mismatch
                          required:
                            - type
                            - failure
                          title: hosted-capabilities-rejected
                  required:
                    - status
                    - boundary
                    - reason
                    - details
                  title: rejected
                - type: object
                  additionalProperties: false
                  properties:
                    status:
                      type: string
                      const: rejected
                      description: Boundary outcome.
                    boundary:
                      type: string
                      const: runtime
                      description: Rejected process boundary.
                    reason:
                      type: string
                      minLength: 1
                      maxLength: 1048576
                      description: Closed boundary rejection reason.
                    bootstrap:
                      anyOf:
                        - type: object
                          additionalProperties: false
                          properties:
                            state:
                              type: string
                              const: unavailable
                              description: Bootstrap state.
                          required:
                            - state
                        - type: object
                          additionalProperties: false
                          properties:
                            state:
                              type: string
                              const: invalid
                              description: Bootstrap state.
                          required:
                            - state
                        - type: object
                          additionalProperties: false
                          properties:
                            state:
                              type: string
                              const: starting
                              description: Bootstrap state.
                            attemptId:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              pattern: >-
                                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
                              description: Bootstrap attempt identity.
                            phase:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              description: Current bootstrap phase.
                            completedPhases:
                              type: integer
                              minimum: 0
                              maximum: 7
                              description: Completed bootstrap phases.
                            totalPhases:
                              type: integer
                              minimum: 1
                              maximum: 7
                              description: Total bootstrap phases.
                            gradleJvm:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_gradleJvmObservation
                          required:
                            - state
                            - attemptId
                            - phase
                            - completedPhases
                            - totalPhases
                            - gradleJvm
                        - type: object
                          additionalProperties: false
                          properties:
                            state:
                              type: string
                              const: ready
                              description: Bootstrap state.
                            attemptId:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              pattern: >-
                                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
                              description: Bootstrap attempt identity.
                            gradleJvm:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_gradleJvmObservation
                            phase:
                              type: string
                              const: ready
                              description: Completed bootstrap phase.
                            completedPhases:
                              type: integer
                              minimum: 7
                              maximum: 7
                              description: Completed bootstrap phases.
                            totalPhases:
                              type: integer
                              minimum: 7
                              maximum: 7
                              description: Total bootstrap phases.
                          required:
                            - state
                            - attemptId
                            - gradleJvm
                            - phase
                            - completedPhases
                            - totalPhases
                        - type: object
                          additionalProperties: false
                          properties:
                            state:
                              type: string
                              const: rejected
                              description: Bootstrap state.
                            attemptId:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              pattern: >-
                                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
                              description: Bootstrap attempt identity.
                            phase:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              description: Rejected bootstrap phase.
                            completedPhases:
                              type: integer
                              minimum: 0
                              maximum: 7
                              description: Completed bootstrap phases.
                            totalPhases:
                              type: integer
                              minimum: 1
                              maximum: 7
                              description: Total bootstrap phases.
                            cause:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              description: Closed bootstrap rejection reason.
                            correctiveAction:
                              type: string
                              minLength: 1
                              maxLength: 1048576
                              description: Bounded corrective action.
                            gradleJvm:
                              $ref: >-
                                #/components/schemas/replace_bodyResponse_gradleJvmObservation
                          required:
                            - state
                            - attemptId
                            - phase
                            - completedPhases
                            - totalPhases
                            - cause
                            - correctiveAction
                            - gradleJvm
                  required:
                    - status
                    - boundary
                    - reason
                    - bootstrap
                  title: rejected
          required:
            - status
            - diagnostic
          title: rejected
    replace_bodyResponse_finiteFailureEvidence:
      type: string
      minLength: 1
      maxLength: 1048576
      description: Finite failure evidence.
      title: finiteFailureEvidence
    replace_bodyResponse_gradleJvmObservation:
      anyOf:
        - type: object
          additionalProperties: false
          properties:
            type:
              type: string
              const: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionObservation.Unobserved
              description: Gradle JVM observation variant.
          required:
            - type
          title: >-
            io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionObservation.Unobserved
        - type: object
          additionalProperties: false
          properties:
            type:
              type: string
              const: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionObservation.Observed
              description: Gradle JVM observation variant.
            report:
              $ref: '#/components/schemas/replace_bodyResponse_gradleJvmReport'
          required:
            - type
            - report
          title: >-
            io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionObservation.Observed
      title: gradleJvmObservation
    replace_bodyResponse_gradleJvmReport:
      type: object
      additionalProperties: false
      properties:
        distribution:
          anyOf:
            - type: object
              additionalProperties: false
              properties:
                type:
                  type: string
                  const: >-
                    io.github.amichne.kast.distribution.contract.gradle.GradleDistributionEvidence.Unavailable
                  description: Gradle distribution evidence variant.
              required:
                - type
              title: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleDistributionEvidence.Unavailable
            - type: object
              additionalProperties: false
              properties:
                type:
                  type: string
                  const: >-
                    io.github.amichne.kast.distribution.contract.gradle.GradleDistributionEvidence.Observed
                  description: Gradle distribution evidence variant.
                version:
                  type: string
                  minLength: 1
                  maxLength: 1048576
                  description: Observed Gradle version.
              required:
                - type
                - version
              title: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleDistributionEvidence.Observed
        requiredJava:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 99
            description: Required Java feature.
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/replace_bodyResponse_gradleJvmCandidate'
          maxItems: 1000
        outcome:
          $ref: '#/components/schemas/replace_bodyResponse_gradleJvmOutcome'
      required:
        - distribution
        - requiredJava
        - candidates
        - outcome
      title: gradleJvmReport
    replace_bodyResponse_gradleJvmCandidate:
      type: object
      additionalProperties: false
      properties:
        java:
          type: integer
          minimum: 1
          maximum: 99
          description: Java feature.
        homeIdentity:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: JDK home identity.
        authority:
          type: string
          description: JDK selection authority.
          enum:
            - DAEMON_JVM_CRITERIA
            - REPOSITORY_GRADLE_PROPERTY
            - AMBIENT_JAVA_HOME
            - SIDECAR_COMPATIBLE
            - PLATFORM_RESOLVER
        decision:
          type: string
          description: JDK candidate decision.
          enum:
            - SELECTED
            - INCOMPATIBLE_GRADLE
            - SHADOWED_BY_PROJECT_AUTHORITY
            - NOT_SELECTED
      required:
        - java
        - homeIdentity
        - authority
        - decision
      title: gradleJvmCandidate
    replace_bodyResponse_gradleJvmOutcome:
      anyOf:
        - type: object
          additionalProperties: false
          properties:
            type:
              type: string
              const: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionOutcome.Selected
              description: Gradle JVM outcome variant.
            candidate:
              $ref: '#/components/schemas/replace_bodyResponse_gradleJvmCandidate'
          required:
            - type
            - candidate
          title: >-
            io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionOutcome.Selected
        - type: object
          additionalProperties: false
          properties:
            type:
              type: string
              const: >-
                io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionOutcome.Rejected
              description: Gradle JVM outcome variant.
            failure:
              type: string
              description: Closed Gradle JVM selection failure.
              enum:
                - GRADLE_DISTRIBUTION_UNAVAILABLE
                - DAEMON_JVM_CRITERIA_UNSUPPORTED
                - REPOSITORY_JAVA_HOME_INVALID
                - LOCAL_JVM_DISCOVERY_FAILED
                - NO_COMPATIBLE_RUNTIME
                - SDK_REGISTRATION_FAILED
          required:
            - type
            - failure
          title: >-
            io.github.amichne.kast.distribution.contract.gradle.GradleJvmSelectionOutcome.Rejected
      title: gradleJvmOutcome

````