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

# Call Tool

> Calls a tool on a specific remote MCP server, used for function calling. Eliminates the need for manual MCP code implementation.
Under the hood, Klavis will instantiates an MCP client and establishes a connection with the remote MCP server to call the tool.



## OpenAPI

````yaml post /mcp-server/call-tool
openapi: 3.1.0
info:
  title: Klavis AI (https://www.klavis.ai)
  description: Klavis AI - Open Source MCP Integrations for AI Applications
  version: 0.1.0
servers:
  - url: https://api.klavis.ai
    description: US Production server
  - url: https://api.eu.klavis.ai
    description: EU Production server
security: []
paths:
  /mcp-server/call-tool:
    post:
      tags:
        - mcp-server
      summary: Call Tool
      description: >-
        Calls a tool on a specific remote MCP server, used for function calling.
        Eliminates the need for manual MCP code implementation.

        Under the hood, Klavis will instantiates an MCP client and establishes a
        connection with the remote MCP server to call the tool.
      operationId: callServerTool
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallToolRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallToolResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CallToolRequest:
      properties:
        serverUrl:
          type: string
          title: Serverurl
          description: The full URL for connecting to the MCP server
        toolName:
          type: string
          title: Toolname
          description: The name of the tool to call
        toolArgs:
          additionalProperties: true
          type: object
          title: Toolargs
          description: The input parameters for the tool
        connectionType:
          $ref: '#/components/schemas/ConnectionType'
          description: >-
            The connection type to use for the MCP server. Default is
            STREAMABLE_HTTP.
          default: StreamableHttp
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Headers
          description: Optional HTTP headers to include when connecting to the server
      type: object
      required:
        - serverUrl
        - toolName
      title: CallToolRequest
    CallToolResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Whether the API call was successful
        result:
          anyOf:
            - $ref: '#/components/schemas/CallToolResult'
            - type: 'null'
          description: The result of the tool call, if successful
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message, if the tool call failed
      type: object
      required:
        - success
      title: CallToolResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConnectionType:
      type: string
      enum:
        - SSE
        - StreamableHttp
      title: ConnectionType
    CallToolResult:
      properties:
        content:
          items: {}
          type: array
          title: Content
          description: The content of the tool call
        isError:
          type: boolean
          title: Iserror
          description: Whether the tool call was successful
          default: false
      type: object
      required:
        - content
      title: CallToolResult
      description: The server's response to a tool call.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      description: Your Klavis AI API key.
      scheme: bearer
      x-fern-bearer:
        name: api_key

````