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

# Call Tool

> Call a specific tool on an MCP server

# Call Tool

Call a specific tool on an MCP server. This is a convenience wrapper around the generic `/mcp/call` endpoint.

## Request

```bash theme={null}
curl -X POST https://api.mcprank.com/v1/mcp/tools/call \
  -H "X-API-Key: sk_mcp_rank_..." \
  -H "Content-Type: application/json" \
  -d '{
    "server_id": "ai.exa/exa",
    "name": "web_search",
    "arguments": {"query": "latest AI news"}
  }'
```

### Headers

<ParamField header="X-API-Key" type="string" required>
  Your MCP Rank API key
</ParamField>

### Body Parameters

<ParamField body="server_id" type="string" required>
  The MCP Rank server ID
</ParamField>

<ParamField body="name" type="string" required>
  Name of the tool to call
</ParamField>

<ParamField body="arguments" type="object">
  Tool arguments (structure depends on tool's inputSchema)
</ParamField>

## Response

Returns the tool's execution result. The structure depends on the specific tool.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.mcprank.com/v1/mcp/tools/call \
    -H "X-API-Key: sk_mcp_rank_..." \
    -H "Content-Type: application/json" \
    -d '{
      "server_id": "ai.exa/exa",
      "name": "web_search",
      "arguments": {"query": "latest AI news", "numResults": 5}
    }'
  ```

  ```python Python theme={null}
  import httpx

  async with httpx.AsyncClient() as client:
      response = await client.post(
          "https://api.mcprank.com/v1/mcp/tools/call",
          headers={"X-API-Key": "sk_mcp_rank_..."},
          json={
              "server_id": "ai.exa/exa",
              "name": "web_search",
              "arguments": {"query": "latest AI news", "numResults": 5}
          }
      )
      result = response.json()
      print(result)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "content": [
      {
        "type": "text",
        "text": "Here are the top results for 'latest AI news':\n\n1. OpenAI announces GPT-5...\n2. Google DeepMind releases..."
      }
    ],
    "isError": false
  }
  ```
</ResponseExample>

## Tool Result Format

MCP tools return results in a standard format:

| Field     | Type    | Description                           |
| --------- | ------- | ------------------------------------- |
| `content` | array   | Array of content blocks               |
| `isError` | boolean | Whether the tool encountered an error |

Content blocks can be:

* **Text**: `{"type": "text", "text": "..."}`
* **Image**: `{"type": "image", "data": "base64...", "mimeType": "image/png"}`
* **Resource**: `{"type": "resource", "resource": {...}}`

## Error Responses

| Status Code | Description                |
| ----------- | -------------------------- |
| 401         | Missing or invalid API key |
| 404         | Server not found           |
| 410         | Server is no longer active |
| 429         | Rate limit exceeded        |
| 502         | Tool execution failed      |

```json Error Response theme={null}
{
  "detail": "Tool call failed: Invalid query parameter"
}
```
