MCP Gateway
ApiTools

Execute tool

Execute a tool on an MCP server by server ID and tool name. Returns the execution result and duration.

POST
/api/v1/tools/execute

Authorization

User API Key
AuthorizationBearer <token>

User API key (mgw_usr_live_* or mgw_usr_test_*)

In: header

access_token?|

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/api/v1/tools/execute" \  -H "Content-Type: application/json" \  -d '{    "server_id": "820efca4-4a15-4ab7-82fc-9e76f6d61325",    "tool_name": "string"  }'
{
  "result": null,
  "server_id": "820efca4-4a15-4ab7-82fc-9e76f6d61325",
  "tool_name": "string",
  "duration_ms": 0,
  "error": "string"
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}