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

# Tools

> Execute MCP tools programmatically.

<Card title="POST /api/tools/call/:server" href="#call-a-tool">
  Call a specific tool on an MCP server.
</Card>

***

### Call a Tool

Execute a specific tool on an MCP server with given arguments.

* **Endpoint**: `/api/tools/call/:server`

* **Method**: `POST`

* **Parameters**:
  * `:server` (string, required): The name of the MCP server.

* **Body**:
  ```json theme={null}
  {
    "toolName": "tool-name",
    "arguments": {
      "param1": "value1",
      "param2": "value2"
    }
  }
  ```
  * `toolName` (string, required): The name of the tool to execute. Accepted in either form:
    * The bare upstream tool name (e.g. `weather`). MCPHub will route it to `:server`.
    * The fully qualified `<server><separator><tool>` form (e.g. `amap-weather`). The separator defaults to `-` and is configurable via `systemConfig.nameSeparator` (see [System Config API](/api-reference/config)). Use the qualified form when an upstream tool name happens to contain the separator and you need to disambiguate.
  * `arguments` (object, optional): The arguments to pass to the tool. Defaults to an empty object.

* **Response**:
  ```json theme={null}
  {
    "success": true,
    "data": {
      "content": [
        {
          "type": "text",
          "text": "Tool execution result"
        }
      ],
      "toolName": "tool-name",
      "arguments": {
        "param1": "value1",
        "param2": "value2"
      }
    }
  }
  ```

**Example Request:**

```bash theme={null}
curl -X POST "http://localhost:3000/api/tools/call/amap" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "toolName": "amap-maps_weather",
    "arguments": {
      "city": "Beijing"
    }
  }'
```

**Notes:**

* The tool arguments are automatically converted to the proper types based on the tool's input schema.
* Use the `x-session-id` header to maintain session state across multiple tool calls if needed.
* This endpoint requires authentication.

***

### Alternative: OpenAPI Tool Execution

For OpenAPI-compatible tool execution without authentication, see the [OpenAPI Integration](/api-reference/openapi#tool-execution) documentation. The OpenAPI endpoints provide:

* **GET** `/api/tools/:serverName/:toolName` - For simple tools with query parameters
* **POST** `/api/tools/:serverName/:toolName` - For complex tools with JSON body

These endpoints are designed for integration with OpenWebUI and other OpenAPI-compatible systems.
