> ## 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: Datasets
  - name: Redteam
  - 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
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

````