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

# Preview an OpenAPI document as tools

> Reads an OpenAPI 3.0 or 3.1 document, pasted or from an HTTPS URL, and lists its operations, servers, and auth options so you can pick operations. Nothing is saved; register the server with POST /v1/managed-tools/servers. Requires mcp-servers:create or mcp-servers:create-personal, and OpenAPI servers enabled for the organization.



## OpenAPI

````yaml /langsmith/tool-gateway-openapi.json post /v1/managed-tools/openapi-previews
openapi: 3.1.0
info:
  description: >-
    LangSmith Tool Gateway lets your applications, agents, and MCP clients call
    MCP tools with each caller's own credentials.


    ## Start here

    1. Register an MCP server or select a built-in integration.

    2. Connect each user's OAuth account or API key when the integration
    requires one.

    3. Optionally create a tool kit containing selected tools.

    4. Call the server or tool kit MCP endpoint from your application, agent, or
    development environment.


    ## API surfaces

    **Management APIs** configure Tool Gateway: `/servers` registers and lists
    MCP servers, `/servers/{id}/credential` manages the current user's
    credential, `/kits` manages curated tool kits, and `/oidc-connection` links
    your identity provider.


    **MCP APIs** discover and invoke tools through standard MCP methods such as
    `tools/list` and `tools/call`: `/servers/{id}/mcp` exposes one server and
    `/kits/{kit_id}/mcp` exposes a tool kit.


    ## Choose who you're calling as

    | You call as | Send |

    | --- | --- |

    | Yourself | A personal `X-Api-Key`, or `Authorization: Bearer
    {langsmith_token}`, plus `X-Tenant-Id` |

    | A user, from your trusted backend | A workspace `X-Api-Key`, the user's
    `Authorization: Bearer {oidc_token}` (or `X-LangSmith-Identity`), and
    `X-Tenant-Id`. Listing servers and MCP calls only |

    | An agent | An API key bound to the agent's environment as `X-Api-Key`,
    plus `X-Tenant-Id` |

    | A profile | `X-Api-Key`, `X-LangSmith-Profile`, and `X-Tenant-Id`.
    Requires workspaces:credentials:use or agent-auth-credentials:use |

    | A user, with your identity provider | The user's `Authorization: Bearer
    {oidc_token}` alone. MCP calls only; built-ins also need `X-Tenant-Id` |


    `X-Tenant-Id` selects a workspace; it does not authenticate you. Service
    keys are not supported, except LangSmith's internal Agent Builder service
    key, which may list servers and make MCP calls, and may change servers and
    credentials only as the user it acts for.


    ## When you're not connected yet

    An MCP call that needs your credential returns 428 with a
    `verification_url`. Open it, connect, and retry. If your client declares
    `elicitation.url`, you get an MCP URL elicitation instead: a -32042 error on
    a 2025-11-25 `initialize`, or an `input_required` result on a 2026-07-28
    `tools/call`. Each names its connection in
    `_meta["com.langchain.langsmith/credential"]`, with `auth_id`, the session
    to check for completion. An agent or profile gets 409 instead; an admin
    connects it.


    ## When a call needs approval

    An approval policy can require your OK before a tool runs. Tool Gateway asks
    through an MCP form elicitation on protocol 2026-07-28 or later and runs the
    call when you accept it on retry. A client that can't show the form gets
    403.


    ## When a server asks you for input

    On protocol 2026-07-28 or later, a tool kit passes the `elicitation`
    capability your `tools/call` declares to the server behind the tool when
    that server also uses 2026-07-28, and relays that server's `input_required`
    result. An elicitation in a mode your request didn't declare returns a
    -32021 MissingRequiredClientCapabilities error naming the mode, and any
    other input request fails the call. Input request keys starting with
    `langsmith_` are reserved for Tool Gateway's own prompts, so a server that
    uses one fails the call. Answer its `inputRequests` and retry with your
    `inputResponses` and the exact `requestState` you received. The
    `requestState` works only for the same caller, tool and arguments, and
    expires after 10 minutes. A server whose request state would seal to more
    than 512 KiB, half a request, fails the call. A call you already approved
    isn't asked again.


    ## Search mode

    `/kits/{kit_id}/mcp?mode=search` lists three tools, `search_tools`,
    `get_tool`, and `call_tool`, instead of every tool. Use it when your host
    puts every listed tool in the model prompt, for example with the me kit
    (`kit_id` = `me`). Calling a tool by name works in both modes.


    Tool Gateway must be enabled for the organization. Endpoint descriptions
    list the required workspace permissions.
  title: LangSmith Tool Gateway API
  contact: {}
  version: v1
servers:
  - url: https://api.smith.langchain.com
    description: GCP US
  - url: https://eu.api.smith.langchain.com
    description: GCP EU
  - url: https://apac.api.smith.langchain.com
    description: GCP APAC
  - url: https://aws.api.smith.langchain.com
    description: AWS US
security: []
tags:
  - description: Register your own MCP servers (public, OAuth or API key) or use built-ins.
    name: Adding tools
  - description: >-
      Store credentials for yourself, an agent, a profile or the whole
      workspace.
    name: Connecting tools
  - description: Serve tools through tool kits, the me kit or a single server.
    name: Exposing tools
  - description: >-
      List and call tools, choose who you act as, and handle connect and
      approval prompts.
    name: Calling tools
paths:
  /v1/managed-tools/openapi-previews:
    post:
      tags:
        - Adding tools
      summary: Preview an OpenAPI document as tools
      description: >-
        Reads an OpenAPI 3.0 or 3.1 document, pasted or from an HTTPS URL, and
        lists its operations, servers, and auth options so you can pick
        operations. Nothing is saved; register the server with POST
        /v1/managed-tools/servers. Requires mcp-servers:create or
        mcp-servers:create-personal, and OpenAPI servers enabled for the
        organization.
      operationId: previewManagedToolsOpenAPI
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAPIPreviewRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAPIPreview'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/OpenAPIPreview'
        '400':
          description: >-
            The document is invalid, larger than 10 MB, or took too long to
            read.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '403':
          description: >-
            Tool Gateway or OpenAPI servers aren't enabled for your
            organization, or you lack the required permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '413':
          description: Request body is too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '501':
          description: OpenAPI servers aren't available in this deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '502':
          description: The document URL didn't return a document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '503':
          description: The document URL couldn't be reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
        '504':
          description: Fetching the document timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ToolGatewayProblem'
      security:
        - API Key: []
          Tenant ID: []
        - Bearer Auth: []
          Tenant ID: []
components:
  schemas:
    OpenAPIPreviewRequest:
      description: An OpenAPI document to preview. Set openapi or openapi_url.
      type: object
      properties:
        openapi:
          description: >-
            OpenAPI 3.0 or 3.1 document, as JSON or YAML text or a JSON object,
            up to 10 MB.
          type: string
        openapi_url:
          description: HTTPS URL to fetch the document from.
          type: string
          example: https://api.example.com/openapi.json
    OpenAPIPreview:
      description: An OpenAPI document and the tools its operations can become.
      type: object
      properties:
        auth_options:
          description: >-
            Ways the operations accept credentials, most used first, to pre-fill
            the connection.
          type: array
          items:
            $ref: '#/components/schemas/OpenAPIAuthOption'
        document_sha256:
          description: SHA-256 of the document text.
          type: string
        openapi_version:
          description: OpenAPI version, 3.0.x or 3.1.x.
          type: string
        operations:
          description: Every operation, including those that cannot become tools.
          type: array
          items:
            $ref: '#/components/schemas/OpenAPIOperation'
        servers:
          description: >-
            Absolute HTTPS server URLs the document declares. The first is the
            default base URL.
          type: array
          items:
            type: string
        title:
          description: Document title.
          type: string
        version:
          description: Document version.
          type: string
    ToolGatewayProblem:
      description: An RFC 7807 problem details error, with LangSmith extensions.
      type: object
      required:
        - status
        - title
        - type
      properties:
        code:
          description: |-
            LangSmith extension: stable machine-readable error code, such as
            missing_permission or monthly_tool_call_limit.
          type: string
        detail:
          description: Explanation of this occurrence of the problem.
          type: string
        instance:
          description: URI reference of the request that caused the problem.
          type: string
        kits:
          description: 'LangSmith extension: tool kits you can see that block the change.'
          type: array
          items:
            $ref: '#/components/schemas/ToolGatewayProblemKit'
        permission:
          description: 'LangSmith extension: the permission the operation requires.'
          type: string
        remedy:
          description: 'LangSmith extension: what you can do to fix the error.'
          type: string
        status:
          description: HTTP status code of the response.
          type: integer
        title:
          description: Short summary of the problem type.
          type: string
        type:
          description: URI reference that identifies the problem type.
          type: string
    OpenAPIAuthOption:
      type: object
      properties:
        operation_count:
          description: Supported operations that accept the option.
          type: integer
        schemes:
          description: Security schemes the option combines, joined with " + ".
          type: array
          items:
            type: string
        security:
          description: Credential placement. Absent when unsupported_reason is set.
          allOf:
            - $ref: '#/components/schemas/OpenAPISecurity'
        unsupported_reason:
          description: Why the option cannot be used.
          type: string
    OpenAPIOperation:
      description: One operation of an OpenAPI document and the tool it becomes.
      type: object
      properties:
        is_deprecated:
          description: The document marks the operation deprecated.
          type: boolean
        is_destructive:
          description: The operation is DELETE.
          type: boolean
        is_read_only:
          description: The operation is GET or HEAD.
          type: boolean
        method:
          description: HTTP method.
          type: string
        name:
          description: >-
            Tool name: the operationId with characters other than letters,
            digits, _ and - replaced by _, up to 48 characters.
          type: string
        operation_id:
          description: operationId. Pass it in operations to select the operation.
          type: string
        path:
          description: Path template.
          type: string
        summary:
          description: Short summary.
          type: string
        tags:
          description: Tags.
          type: array
          items:
            type: string
        unsupported_reason:
          description: Why the operation cannot become a tool. Empty when it can.
          type: string
    ToolGatewayProblemKit:
      description: A tool kit that blocks a change.
      type: object
      properties:
        id:
          description: Tool kit ID.
          type: string
          format: uuid
        name:
          description: Tool kit name.
          type: string
    OpenAPISecurity:
      type: object
      required:
        - type
      properties:
        keys:
          description: >-
            API keys sent together, for api_keys. Each key's name is also the
            credential field a user fills in.
          type: array
          items:
            $ref: '#/components/schemas/OpenAPIAPIKey'
        oauth:
          description: >-
            OAuth provider the document declares. Shown in previews and ignored
            on create, where the OAuth connection supplies the provider.
          allOf:
            - $ref: '#/components/schemas/OpenAPIOAuthFlow'
        type:
          description: How credentials reach the API.
          enum:
            - none
            - api_keys
            - bearer
            - basic
            - oauth2
          allOf:
            - $ref: '#/components/schemas/OpenAPISecurityType'
    OpenAPIAPIKey:
      type: object
      required:
        - in
        - name
      properties:
        in:
          description: Where the API reads the key.
          type: string
          enum:
            - header
            - query
            - cookie
        name:
          description: Header, query parameter, or cookie name.
          type: string
    OpenAPIOAuthFlow:
      type: object
      properties:
        authorization_url:
          type: string
        discovery_url:
          type: string
        grant_type:
          type: string
          enum:
            - authorization_code
            - client_credentials
        scopes:
          type: array
          items:
            type: string
        token_url:
          type: string
    OpenAPISecurityType:
      type: string
      enum:
        - none
        - api_keys
        - bearer
        - basic
        - oauth2
  securitySchemes:
    API Key:
      description: >-
        Personal or workspace LangSmith API key. Personal keys identify the
        user. Workspace keys are limited to server listing and MCP calls and
        must also supply the end user's OIDC token or X-LangSmith-Identity.
      type: apiKey
      name: X-Api-Key
      in: header
    Tenant ID:
      description: >-
        Workspace UUID. This header selects a workspace; it does not
        authenticate the caller.
      type: apiKey
      name: X-Tenant-Id
      in: header
    Bearer Auth:
      description: >-
        Send `Bearer {token}`. The token may be issued by LangSmith or by the
        workspace's linked identity provider. A linked-provider token can
        authenticate MCP calls by itself, or identify the end user when paired
        with a workspace API key.
      type: apiKey
      name: Authorization
      in: header

````