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

# Call MCP Server Tool

> Executes a tool call on an MCP server — the playground API for testing and debugging tools by directly invoking them with parameters.

The target server is identified by the `X-Enkrypt-MCP-Registry-Server` header — the gateway fetches its config from `GET /mcp-registry/get-server` using your `apikey` and uses the cloud's 200/401/403 response as the authentication gate.

The request body carries the tool invocation: `tool_name` (required) and optional `tool_arguments`.



## OpenAPI

````yaml POST /mcp-playground/call-tool
openapi: 3.0.0
info:
  title: Enkrypt AI APIs
  version: 2.0.0
servers:
  - url: https://api.enkryptai.com
security:
  - apiKeyAuth: []
tags:
  - name: Guardrails
  - name: Code of Conduct
  - name: Endpoints
  - name: Redteam
    description: >-
      Red Team API: submit red-team / threat-modeling / playground / eval runs,
      then poll run status, records, results and compliance. Also two-phase
      threat modeling (categories + data), dataset retrieval, model health,
      findings and risk mitigation. The previous task-based Red Team API is
      under **Archived**.
  - name: Deployments
  - name: AI Proxy
  - name: Leaderboard
  - name: Archived
  - name: MCP Hub
    description: >-
      MCP Hub vulnerability scanning APIs. Submitting scans (the POST endpoints)
      is open to all authenticated callers. The scan **retrieval** APIs — Get
      Scan Job Status, Get Complete Scan Results, List Scans, and Get MCP Hub
      Scan Statistics (the GET endpoints) — are an **enterprise data-license
      feature**: they require your organization to have MCP Hub API access
      enabled by Enkrypt, otherwise they return `403`. Contact us at
      support@enkryptai.com to enable access.
  - name: MCP Registry Servers
  - name: MCP Gateways
  - name: MCP Playground
  - name: Skill Scanner
    description: >-
      Skill Scanner APIs: submit an agent skill (a directory inside a git
      repository) for security scanning, then read the verdict, the risk level
      and the full report. Scanning is asynchronous — a scan takes roughly 30–90
      seconds, so `POST /skill-hub/scan` returns a `scan_id` you poll.


      You see your organization's scans and nobody else's. The identity comes
      from your API key, never from your request — sending `user_email` is a
      `400`.


      For an organization or project API key, scans are filed under the
      **organization**, so every member sees every scan the organization has
      run, whichever project or member submitted it. For an individual account
      it is simply your own scans. Either way List Skill Scans needs no
      parameter to say who you are.
  - name: Compliance
    description: >-
      Compliance APIs: connect a ChatGPT Enterprise workspace, then keep reading
      its compliance logs and scanning every message through one of your saved
      guardrails.


      Every endpoint here — reads as well as writes — requires the **governance
      officer** role on the project your API key belongs to. The organization
      owner is **not** exempt: an owner who has not been granted the role gets
      `403` like anyone else. An individual (non-organization) account cannot
      hold the role at all, so compliance is an organization-only feature today.


      A scan is addressed by name in the `X-Enkrypt-Scan` header, within the
      project its API key belongs to. Message text is never stored: Get
      Compliance Message fetches it live from the provider, and only while the
      provider still holds it.
paths:
  /mcp-playground/call-tool:
    post:
      tags:
        - MCP Playground
      summary: Call MCP Server Tool
      description: >-
        Executes a tool call on an MCP server — the playground API for testing
        and debugging tools by directly invoking them with parameters.


        The target server is identified by the `X-Enkrypt-MCP-Registry-Server`
        header — the gateway fetches its config from `GET
        /mcp-registry/get-server` using your `apikey` and uses the cloud's
        200/401/403 response as the authentication gate.


        The request body carries the tool invocation: `tool_name` (required) and
        optional `tool_arguments`.
      operationId: callMCPTool
      parameters:
        - $ref: '#/components/parameters/MCPGatewayRegistryServerHeader'
        - $ref: '#/components/parameters/MCPGatewayRegistryServerVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPGatewayCallToolRequest'
            examples:
              read-file:
                summary: Read a file
                value:
                  tool_name: read_file
                  tool_arguments:
                    path: /tmp/test.txt
              write-file:
                summary: Write to a file
                value:
                  tool_name: write_file
                  tool_arguments:
                    path: /tmp/output.txt
                    content: Hello, World!
      responses:
        '200':
          description: Tool executed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MCPGatewayCallToolResponse'
        '400':
          $ref: '#/components/responses/MCPGatewayBadRequest'
        '401':
          $ref: '#/components/responses/MCPGatewayUnauthorized'
        '403':
          $ref: '#/components/responses/MCPGatewayForbidden'
        '404':
          $ref: '#/components/responses/MCPGatewayNotFound'
        '429':
          description: Resource limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MCPGatewayErrorResponse'
        '500':
          $ref: '#/components/responses/MCPGatewayInternalError'
      servers:
        - url: https://mcp.enkryptai.com
components:
  parameters:
    MCPGatewayRegistryServerHeader:
      name: X-Enkrypt-MCP-Registry-Server
      in: header
      required: true
      description: Registry server saved_name
      schema:
        type: string
        maxLength: 32
        example: my-filesystem-server
    MCPGatewayRegistryServerVersionHeader:
      name: X-Enkrypt-MCP-Registry-Server-Version
      in: header
      required: false
      description: Registry server version (defaults to "v1")
      schema:
        type: string
        default: v1
        example: v1
  schemas:
    MCPGatewayCallToolRequest:
      type: object
      required:
        - tool_name
      properties:
        tool_name:
          type: string
          description: Name of the tool to call
          example: read_file
        tool_arguments:
          type: object
          additionalProperties: true
          description: Arguments to pass to the tool (max 100KB, max depth 10 levels)
    MCPGatewayCallToolResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the tool call was successful
        error:
          type: string
          nullable: true
          description: Error message if failed
        details:
          type: string
          nullable: true
          description: Additional error details
        data:
          type: object
          properties:
            saved_name:
              type: string
              description: Registry server name
            server_version:
              type: string
              description: Server version
            server_name:
              type: string
              nullable: true
              description: MCP server package name
            description:
              type: string
              nullable: true
              description: Server description
            tool_name:
              type: string
              description: Name of the tool that was called
            tool_arguments:
              type: object
              additionalProperties: true
              description: Arguments that were passed to the tool
            result:
              type: object
              description: Result from the tool execution
              properties:
                content:
                  type: array
                  description: Content returned by the tool
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        description: Content type (e.g., text, image)
                      text:
                        type: string
                        nullable: true
                        description: Text content
                      data:
                        type: string
                        nullable: true
                        description: Base64-encoded data for non-text content
                      mimeType:
                        type: string
                        nullable: true
                        description: MIME type for non-text content
                isError:
                  type: boolean
                  description: Whether the tool execution resulted in an error
            executed_at:
              type: string
              format: date-time
              description: Timestamp when the tool was executed
    MCPGatewayErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
  responses:
    MCPGatewayBadRequest:
      description: Bad request - invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MCPGatewayErrorResponse'
    MCPGatewayUnauthorized:
      description: Unauthorized - invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MCPGatewayErrorResponse'
    MCPGatewayForbidden:
      description: Forbidden - insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MCPGatewayErrorResponse'
    MCPGatewayNotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MCPGatewayErrorResponse'
    MCPGatewayInternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MCPGatewayErrorResponse'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey

````

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