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

# Respond to an API turn input

> Use the initiating project API key. Send the current round and an answer object for every form key returned by the read operation. An invalid answer leaves the form pending so you can correct it. After acceptance, repeat the same round, response key, and answers when retrying the response. If the MCP server requests another round, read that round before answering. An indeterminate outcome means the operation may have run. Verify its outcome before attempting a new turn.



## OpenAPI

````yaml /reference/openapi.json post /chat-sessions/turns/{turnId}/inputs
openapi: 3.1.0
info:
  title: MCPJam API
  version: 1.0.0-preview
  description: >-
    Programmatic access to MCP servers saved in your MCPJam projects: live
    diagnostics (validate, inspect, export) and operations: call tools, render
    prompts, run eval suites asynchronously and poll their results, and import
    OAuth tokens.


    **The API is in preview**: the surface may change while we finish the
    design. Error `code` values are stable; error `message` strings are not.
    Write clients that ignore unknown response fields.
  contact:
    name: MCPJam
    url: https://github.com/MCPJam/inspector/issues
servers:
  - url: https://app.mcpjam.com/api/v1
    description: Hosted MCPJam
security:
  - bearerAuth: []
tags:
  - name: Clients
    description: >-
      Clients: the named, reusable configurations that define how MCPJam
      connects to and talks to your MCP servers. The original `/hosts` paths
      remain as deprecated, ID-only compatibility aliases with their original
      DTOs and their original (tokenless) write contracts; every alias response
      carries `Deprecation: true`. New integrations should use `/clients`.
  - name: Environments
    description: >-
      Project environments: named, live-editable execution bundles (one host and
      an optional standalone server group) that eval suites and goals run
      against. Reads require project membership; archiving requires project
      admin.
  - name: Server diagnostics
    description: Connect-level health checks against a saved MCP server.
  - name: Primitives
    description: 'The server''s MCP primitives: tools, prompts, and resources.'
  - name: Export
    description: Full-server snapshots for diffing and CI.
  - name: Execution
    description: 'Run the server''s primitives: call tools, render prompts.'
  - name: Eval runs
    description: >-
      Asynchronous eval suite runs: create with 202, poll status, iterations,
      and traces.
  - name: Conformance runs
    description: >-
      Ingest MCP spec-conformance results from the SDK/CLI into project-owned
      history. Distinct from Eval runs (authored LLM cases) and from directory
      readiness.
  - name: Server connections
    description: >-
      Connect an MCP server URL to a project, authorizing in a browser when the
      server requires it.
  - name: Server accounts
    description: >-
      The accounts a saved server signs in with, addressed by id or by name.
      Tokens are write-only: an upload takes them and no route returns one.
  - name: OAuth
    description: 'Bring-your-own OAuth: import externally obtained tokens for a server.'
  - name: Studies
    description: >-
      Publish a project environment as a **study** for people outside the
      project to talk to, read what they did, and control who can reach it.
      Several of these NARROW access and take effect immediately.


      The pre-rename paths (`/projects/{projectId}/scenarios`,
      `/projects/{projectId}/scenarios/{scenarioId}`,
      `/projects/{projectId}/environments/{environmentId}/scenario` and
      `/projects/{projectId}/user-testing/scenarios/{scenarioId}/…`) keep
      working and are deliberately not documented here. They return their
      original bodies, which spell the owning id `scenarioId` and whose detail
      read carries no execution settings, and every response answers with
      `Deprecation: true` and a `Link` header naming its successor. They are
      removed at general availability; a new integration should use the paths on
      this page.
  - name: Catalog
    description: >-
      Discover the resources the other routes operate on: your account,
      projects, servers, eval suites, and chat sessions.
  - name: Tunnels
    description: >-
      Relay tunnels that expose local MCP servers through a public URL,
      registered as first-class project servers (the `mcpjam cloud tunnel` CLI
      flow).
  - name: Agent
    description: >-
      Headless agent turns over the public API: send a message history, the
      server runs one assistant turn with project-scoped workspace tools (eval
      reads + suite creation) on a pinned hosted model, and returns the reply
      plus created-resource references.
  - name: Swarms
    description: >-
      Personas, journeys and swarm containers (the authoring half of Swarms)
      plus the model-backed generation that drafts them.
  - name: Swarm runs
    description: >-
      Launching journeys and reading what they produced. Launching SPENDS. See
      the per-operation notes.
  - name: Swarm insights
    description: >-
      What a swarm run revealed. The scorecard and findings are deterministic
      and free; requesting wave insights runs models and draws on your shared
      daily ledger.
  - name: Directory readiness
    description: >-
      Grade a saved server against a publisher's listing requirements:
      Anthropic's connector directory or OpenAI's plugin directory. Reported as
      lane status and coverage, never as a numeric score, and excluded from
      `pooledConformanceScore`. Deterministic grading is free; model-backed
      experience observations are an explicit opt-in whose model cost is on
      MCPJam (no credits are consumed) and they can never decide a verdict.
  - name: Feedback
    description: >-
      Feedback about MCPJam itself (bugs, missing capabilities, confusing
      behavior), sent to the MCPJam team and kept for 180 days. The
      `send_feedback` MCP tool calls the same endpoint.
paths:
  /chat-sessions/turns/{turnId}/inputs:
    post:
      tags:
        - Chat sessions
      summary: Respond to an API turn input
      description: >-
        Use the initiating project API key. Send the current round and an answer
        object for every form key returned by the read operation. An invalid
        answer leaves the form pending so you can correct it. After acceptance,
        repeat the same round, response key, and answers when retrying the
        response. If the MCP server requests another round, read that round
        before answering. An indeterminate outcome means the operation may have
        run. Verify its outcome before attempting a new turn.
      operationId: respondToChatTurnInput
      parameters:
        - name: turnId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatTurnInputResponse'
      responses:
        '200':
          description: >-
            The completed turn or the current form state, including expiry and
            indeterminate outcomes.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ChatTurn'
                  - $ref: '#/components/schemas/ChatTurnInputState'
        '202':
          description: >-
            The next form, a delivery still pending, or a subsequent tool
            approval.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ChatTurnInputState'
                  - $ref: '#/components/schemas/ChatTurnApprovalState'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: >-
            The turn has no form checkpoint available to this key. A different
            key from the same owner also receives 404.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The saved form rejected the answers (`details.reason:
            FORM_RESPONSE_INVALID`), the round or idempotent retry conflicts, or
            the continuation is unavailable. Read the inputs for the current
            state, then correct an invalid answer and resubmit the same round.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/FeatureNotSupported'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          $ref: '#/components/responses/ServerUnreachable'
        '504':
          $ref: '#/components/responses/Timeout'
components:
  schemas:
    ChatTurnInputResponse:
      type: object
      additionalProperties: false
      required:
        - round
        - responseKey
        - responses
      properties:
        round:
          type: integer
          minimum: 0
        responseKey:
          type: string
          minLength: 1
          maxLength: 200
          description: Stable key for retries of an accepted answer in this round.
        responses:
          type: object
          description: >-
            An answer object for each key in the pending forms. Each object must
            match its requested schema.
          additionalProperties:
            type: object
            additionalProperties: true
    ChatTurn:
      type: object
      required:
        - sessionId
        - turnId
        - projectId
        - persisted
        - origin
      properties:
        sessionId:
          type:
            - string
            - 'null'
          description: >-
            The one public session id. Pass it back to continue, and to the
            trace/detail reads. NULL only when the turn ran but its transcript
            did not persist, which `persisted.outcome` reports, and which must
            not be read as "nothing happened": the turn already spent.
        turnId:
          type: string
          description: >-
            Minted by the turn lease and used by the ingest dedupe, so it names
            the same turn in both.
        projectId:
          type: string
          description: >-
            The project this turn ran in. On a continuation the caller never
            sent it (it comes off the session row), so this is the only place
            the response names the session's project.
        reply:
          type: string
        finishReason:
          type:
            - string
            - 'null'
        toolCalls:
          type: array
          items:
            $ref: '#/components/schemas/ChatTurnToolCall'
        trace:
          type: object
          description: This turn's spans, inline.
          properties:
            turnId:
              type: string
            spanCount:
              type: integer
            spans:
              type: array
              items:
                type: object
        usage:
          $ref: '#/components/schemas/TurnUsage'
        model:
          type: object
          properties:
            id:
              type: string
            provider:
              type: string
        toolMode:
          type: string
          enum:
            - read_only
            - auto
        engine:
          type: string
          description: >-
            WHICH ENGINE RAN: `emulated`, or `harness:<id>` such as
            `harness:claude-code`. Present on every turn. Read it rather than
            infer it from `model`. `hostId` is per-turn: a continuation of a
            host-only session is refused without it, and one that pinned its own
            `serverIds` runs the emulated engine: this is the field that says
            which.
        hostId:
          type: string
          description: >-
            The saved host this turn executed as: the pointer the caller sent,
            or the host the targeted environment pins. Absent when the turn
            named no host.
        skippedServers:
          type: array
          description: >-
            Servers omitted from this turn because they could not connect. The
            reply still runs when every selected server is skipped.
          items:
            type: object
            required:
              - serverId
              - serverName
              - reason
              - message
            properties:
              serverId:
                type: string
              serverName:
                type: string
              reason:
                type: string
                enum:
                  - hosted_requires_https
                  - hosted_stdio_unsupported
                  - needs_sign_in
                  - unreachable
                  - other
              message:
                type: string
        advertisedToolCount:
          type: integer
          description: Tools the model could see this turn.
        excludedToolCount:
          type: integer
          description: Tools the tool policy withheld.
        persisted:
          type: object
          properties:
            outcome:
              type: string
            version:
              type: integer
        origin:
          type: string
          enum:
            - api
        replay:
          type: boolean
          description: >-
            Set when this idempotencyKey replayed an already-completed turn.
            Nothing was spent.
        message:
          type: string
        chatSessionId:
          type: string
        browser:
          type: object
          properties:
            effectivePolicy:
              type: object
              description: >-
                Permissions after intersecting the stored grant, current host
                ceiling, and read-only tool mode. Null is unrestricted; an empty
                list denies all.
              properties:
                tools:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                origins:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
              required:
                - tools
                - origins
            browserSessionId:
              type: string
            state:
              type: string
              enum:
                - active
                - sleeping
                - closed
            policy:
              $ref: '#/components/schemas/BrowserToolPolicy'
            profileId:
              type: string
            bootId:
              type: string
            controlledBy:
              type:
                - string
                - 'null'
              enum:
                - human
                - null
            box:
              type:
                - string
                - 'null'
            lastActiveAt:
              type: number
            attached:
              type: boolean
            reason:
              type: string
            refusal:
              type: string
              enum:
                - cloud_browser_unavailable
                - cloud_browser_not_configured
                - cloud_browser_unavailable_installation
              description: >-
                Why a requested browser did not attach, when it can be named.
                `cloud_browser_unavailable`: Cloud Browser cannot start right
                now; retry in a few minutes. `cloud_browser_not_configured`:
                Cloud Browser is not available on this deployment yet.
                `cloud_browser_unavailable_installation`: this self-hosted
                installation has no working Cloud Browser setup. `reason`
                carries the human-readable detail.
            screenshots:
              type: array
              items:
                $ref: '#/components/schemas/BrowserScreenshot'
            notices:
              type: array
              items:
                type: string
            handoff:
              type: object
              properties:
                waited:
                  type: boolean
                resumed:
                  type: boolean
              required:
                - waited
                - resumed
          required:
            - attached
    ChatTurnInputState:
      type: object
      required:
        - turnId
        - status
      description: >-
        Pending form details are present while the turn is ready for answers. A
        form state can also contain only the turn ID and status, such as while
        delivering the saved result or after terminal settlement.
      properties:
        turnId:
          type: string
        status:
          type: string
          enum:
            - pending
            - resuming
            - completed
            - failed
            - cancelled
            - expired
            - indeterminate
        sessionId:
          type: string
        hostId:
          type: string
        hostConfigId:
          type: string
        continuationId:
          type: string
        round:
          type: integer
          minimum: 0
        expiresAt:
          type: integer
          description: Expiry time in Unix milliseconds.
        toolCallId:
          type: string
        toolName:
          type: string
        responseSubmitted:
          type: boolean
        forms:
          type: array
          items:
            type: object
            required:
              - key
              - message
              - requestedSchema
            properties:
              key:
                type: string
              message:
                type: string
              requestedSchema:
                type: object
                additionalProperties: true
    ChatTurnApprovalState:
      type: object
      required:
        - projectId
        - turnId
        - sessionId
        - status
        - expiresAt
        - calls
      properties:
        projectId:
          type: string
        turnId:
          type: string
        sessionId:
          type: string
        status:
          type: string
          enum:
            - paused
            - active
            - completed
            - failed
            - unknown
            - expired
        expiresAt:
          type: integer
          description: Expiry time in Unix milliseconds.
        calls:
          type: array
          items:
            type: object
            required:
              - approvalId
              - toolCallId
              - toolName
              - argumentsDigest
              - argumentsPreview
              - decision
            properties:
              approvalId:
                type: string
              toolCallId:
                type: string
              toolName:
                type: string
              argumentsDigest:
                type: string
              argumentsPreview:
                type: string
              decision:
                type:
                  - string
                  - 'null'
                enum:
                  - allow
                  - deny
                  - null
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: >-
            Stable, machine-readable error code. New codes may be added over
            time; treat unknown codes as non-retryable failures unless the HTTP
            status says otherwise.
          enum:
            - UNAUTHORIZED
            - FORBIDDEN
            - NOT_FOUND
            - CONFLICT
            - VALIDATION_ERROR
            - RATE_LIMITED
            - FEATURE_NOT_SUPPORTED
            - SERVER_UNREACHABLE
            - TIMEOUT
            - OAUTH_REQUIRED
            - AUTH_REQUIRED
            - INTERNAL_ERROR
        message:
          type: string
          description: >-
            Human-readable description. May change between releases. Don't match
            on it.
        details:
          type: object
          description: Optional, unstructured context bag.
          additionalProperties: true
    ChatTurnToolCall:
      type: object
      required:
        - toolCallId
        - toolName
        - input
        - status
      properties:
        toolCallId:
          type: string
        toolName:
          type: string
        input:
          description: >-
            The raw arguments sent, scrubbed of protocol annotations (`_meta`,
            `$`-prefixed keys) and bounded.
        status:
          type: string
          enum:
            - ok
            - error
        output:
          description: >-
            The raw result, scrubbed and bounded. Absent when no result was
            recorded.
        errorMessage:
          type: string
        truncated:
          type: boolean
          description: >-
            Part of `input` or `output` was shortened. Shortened values keep
            their JSON type, so `output.isError` still parses: a long string
            ends in `…[+N chars]` and a long array ends in an `…[+N items]`
            item. Always announced: a silently shortened result an agent
            believes is complete sends it debugging the wrong thing.
        truncatedFields:
          type: array
          description: >-
            Each cut, with its path under `input` or `output`. Present when
            `truncated` is.
          items:
            $ref: '#/components/schemas/TruncatedField'
    TurnUsage:
      type: object
      properties:
        inputTokens:
          type: integer
        outputTokens:
          type: integer
        totalTokens:
          type: integer
    BrowserToolPolicy:
      type: object
      properties:
        mode:
          type: string
          enum:
            - allow_all
            - read_only
            - allowlist
        originAllowlist:
          type: array
          minItems: 1
          maxItems: 100
          items:
            type: string
        toolAllowlist:
          type: array
          minItems: 1
          maxItems: 100
          items:
            type: string
      required:
        - mode
      additionalProperties: false
    BrowserScreenshot:
      type: object
      properties:
        turnId:
          type: string
        toolCallId:
          type: string
        toolName:
          type: string
        stepIndex:
          type: integer
        status:
          type: string
          enum:
            - ready
            - not_captured
            - unavailable
        url:
          type: string
          format: uri
        mediaType:
          type: string
          enum:
            - image/png
            - image/jpeg
        bytes:
          type: integer
        ts:
          type: number
      required:
        - toolCallId
        - stepIndex
    TruncatedField:
      type: object
      description: One place a bounded payload holds less than the original.
      required:
        - path
        - reason
      properties:
        path:
          type: string
          description: >-
            JSONPath-like, starting at a field of the object that carries the
            list: `content[0].text`, `output.structuredContent.items`, `input["a
            b"]`.
        reason:
          type: string
          enum:
            - length
            - items
            - depth
          description: >-
            `length`: a string was shortened, and ends in `…[+N chars]`.
            `items`: an array kept its first items and ends in an `…[+N items]`
            item (or, for a payload whose keys alone are over the limit, an
            object kept its first entries). `depth`: nesting, or a circular
            reference, became a marker string.
        originalLength:
          type: integer
          description: >-
            The string's length, or the item count, before the cut. Absent for
            `depth`.
  responses:
    ValidationError:
      description: Malformed body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: VALIDATION_ERROR
            message: Invalid JSON body
    Unauthorized:
      description: >-
        Missing, invalid, revoked, or orphaned key (`UNAUTHORIZED`), or the
        **target MCP server** needs an OAuth grant (`OAUTH_REQUIRED`), which is
        a property of the server, not your key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            badKey:
              summary: Invalid or revoked key
              value:
                code: UNAUTHORIZED
                message: Invalid API key
            oauthRequired:
              summary: Target server needs an OAuth grant
              value:
                code: OAUTH_REQUIRED
                message: Server requires OAuth authorization
    Forbidden:
      description: Key is valid but not allowed to do this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: FORBIDDEN
            message: You do not have access to this project
    FeatureNotSupported:
      description: The target server doesn't support this MCP capability.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: FEATURE_NOT_SUPPORTED
            message: Server does not support resources
    RateLimited:
      description: >-
        Per-key rate limit exceeded (60 requests/minute sustained, bursts up to
        10). Honor `Retry-After` and back off with jitter.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: RATE_LIMITED
            message: API key rate limit exceeded. Slow down and retry.
    InternalError:
      description: Something failed on MCPJam's side.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: INTERNAL_ERROR
            message: Unexpected internal error
    ServerUnreachable:
      description: Could not connect to the target MCP server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: SERVER_UNREACHABLE
            message: Failed to connect to server
    Timeout:
      description: The target MCP server connected but didn't respond in time.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: TIMEOUT
            message: Request to server timed out
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        MCPJam API key (`sk_…`). Create one at [Settings → API
        keys](https://app.mcpjam.com/settings/api-keys). Guest sessions cannot
        use the API, and API keys cannot manage other API keys.

````

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