> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.rightbrain.ai/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# Record MCP Run

POST https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/mcp_server/{mcp_server_id}/mcp_run
Content-Type: application/json

Record a new MCP tool execution.

This endpoint is typically called automatically when tools are invoked,
but can be used manually for:
- Custom tool integrations
- Testing and debugging
- Simulating tool calls
- Recording manual operations

The run record captures the complete interaction for audit and analysis. The
`mcp_server_id` in the request body must match the `mcp_server_id` path
parameter.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/connections/mcp-runs/create-mcp-run

## Authentication

- `Authorization` header (bearer token, required) — API key or access token, sent as `Authorization: Bearer <token>`. The simplest option: create an API key in your dashboard under Settings, then paste it here.

## Servers

- `https://app.rightbrain.ai/api/v1` (Production, default)
- `https://app.rightbrain.ai/api/v1` (Staging API)
- `https://app.rblocal.dev/api/v1` (Local development)

## Request

### Path parameters

- `mcp_server_id` (string, required) — The UUID of the MCP server
- `org_id` (string, required) — The unique identifier of the organization.
- `project_id` (string, required) — The unique identifier of the project.

### Body (application/json)

This endpoint expects a McpRunCreate.

- `method` (string, required) — MCP method name
- `request` (map from string to any, required) — Request data
- `response` (map from string to any, required) — Response data
- `mcp_server_id` (string, required) — MCP server ID
- `request_id` (string, optional, nullable) — JSON-RPC request ID
- `protocol_version` (string, optional, nullable) — MCP protocol version
- `duration_ms` (integer, optional, nullable) — Duration in milliseconds
- `sse_event` (boolean, optional, default: false) — Whether this is a server-sent event

## Response

### 200

MCP run created successfully

- `method` (string, required) — MCP method name
- `request` (map from string to any, required) — Request data
- `response` (map from string to any, required) — Response data
- `id` (string, required) — Unique identifier for the MCP run
- `mcp_server_id` (string, required) — MCP server ID
- `created` (string, required) — Timestamp when the MCP run was created
- `modified` (string, required) — Timestamp when the MCP run was last modified
- `request_id` (string, optional, nullable) — JSON-RPC request ID
- `protocol_version` (string, optional, nullable) — MCP protocol version
- `duration_ms` (integer, optional, nullable) — Duration in milliseconds
- `sse_event` (boolean, optional, default: false) — Whether this is a server-sent event

## Errors

### 400 Bad Request Error

Bad Request - Invalid request **Common causes:** - Invalid UUID format in path or query parameters - Missing required fields in the request body - Invalid enum value provided - Type mismatch (e.g., string instead of number) **Resolution:** Check the request body and parameters match the schema.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 401 Unauthorized Error

Unauthorized - Authentication failed **Common causes:** - Missing `Authorization` header - Expired access token - Invalid or malformed token - Using API key in wrong format **Resolution:** Ensure you're including a valid Bearer token or API key in the Authorization header.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 403 Forbidden Error

Forbidden - Insufficient permissions for MCP server **Common causes:** - Your role lacks the required permission for this action - The MCP server belongs to a different organization or project - The action requires admin or owner privileges **Resolution:** Contact your organization admin to request appropriate access.

- `CreateMcpRunRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 404 Not Found Error

MCP server not found

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 422 Unprocessable Entity Error

Unprocessable Entity - Invalid request **Common causes:** - Request is well-formed but violates business rules - Invalid combination of fields (e.g., mutually exclusive options) - Referenced resource doesn't exist or is in wrong state - Field value is valid type but out of acceptable range **Resolution:** Check the error message for specific validation failures and adjust your request.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 500 Internal Server Error

Internal Server Error - Failed to execute MCP tool

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

## Types

### ErrorResponseDetail

A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

- string
- list of ErrorResponseDetailOneOf1Items
- ErrorResponseDetail2
- ErrorResponseDetail3
- ErrorResponseDetail4

### PermissionCheckFailedErrorResponse

- `detail` (PermissionCheckFailedErrorPayload, required) — The error payload.

### MissingAuthenticationErrorResponse

- `detail` (MissingAuthenticationErrorPayload, required) — The error payload.

### ErrorResponseDetailOneOf1Items

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf1ItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### ErrorResponseDetail2

Validation error returned by a service after request parsing, such as a Task clone dependency failure.

- `type` ("validation_error", required)
- `errors` (list of ErrorResponseDetailOneOf2ErrorsItems, required)

### ErrorResponseDetail3

Domain error raised via a brain.exc.BaseError subclass. The exact extra field name and shape vary by error type.

- `reason` (string, required) — Machine-readable, upper-snake-case error reason, e.g. RESOURCE_NOT_FOUND, PERMISSION_CHECK_FAILED, TAG_NAME_CONFLICT.
- `message` (string, required) — Human-readable error message

### ErrorResponseDetail4

Integration precondition failure. Uses `code` rather than `reason`, and carries no extra field. Raised by the Gmail trigger routes when the underlying integration is not authorized.

- `code` (string, required) — Machine-readable code, e.g. GMAIL_INTEGRATION_AUTH_REQUIRED.
- `message` (string, required) — Human-readable error message

### PermissionCheckFailedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `PERMISSION_CHECK_FAILED`
- `permissionCheckFailedError` (PermissionCheckFailedErrorDetails, required) — Metadata detailing more information about the error.

### MissingAuthenticationErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MISSING_AUTHENTICATION`
- `missingAuthenticationError` (EmptyErrorDetails, required) — Metadata detailing more information about the error.

### ErrorResponseDetailOneOf1ItemsLocItems

- string
- integer

### ErrorResponseDetailOneOf2ErrorsItems

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf2ErrorsItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### PermissionCheckFailedErrorDetails

- `permission` (string, required)
- `subject` (IAMObjectErrorDetails, optional, nullable)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### EmptyErrorDetails

### ErrorResponseDetailOneOf2ErrorsItemsLocItems

- string
- integer

### IAMObjectErrorDetails

- `type` (string, required)
- `id` (string, optional, nullable)

## Examples

### Successful Tool Call

**Request**

```json
{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "delayed"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "content": [
      {
        "text": "12 orders are currently delayed.",
        "type": "text"
      }
    ],
    "isError": false
  },
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "2",
  "protocol_version": "2025-06-18",
  "duration_ms": 184,
  "sse_event": false
}
```

**Response**

```json
{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "delayed"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "content": [
      {
        "text": "12 orders are currently delayed.",
        "type": "text"
      }
    ],
    "isError": false
  },
  "id": "01990829-9213-7168-95a4-bf2a3b4c5d6f",
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "created": "2026-07-10T09:01:47Z",
  "modified": "2026-07-10T09:01:47Z",
  "request_id": "2",
  "protocol_version": "2025-06-18",
  "duration_ms": 184,
  "sse_event": false
}
```

**SDK Code**

```python Successful Tool Call
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run"

payload = {
    "method": "tools/call",
    "request": {
        "arguments": { "status": "delayed" },
        "name": "query_orders_by_status"
    },
    "response": {
        "content": [
            {
                "text": "12 orders are currently delayed.",
                "type": "text"
            }
        ],
        "isError": False
    },
    "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
    "request_id": "2",
    "protocol_version": "2025-06-18",
    "duration_ms": 184,
    "sse_event": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Successful Tool Call
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"method":"tools/call","request":{"arguments":{"status":"delayed"},"name":"query_orders_by_status"},"response":{"content":[{"text":"12 orders are currently delayed.","type":"text"}],"isError":false},"mcp_server_id":"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e","request_id":"2","protocol_version":"2025-06-18","duration_ms":184,"sse_event":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Tool Call
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run"

	payload := strings.NewReader("{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"delayed\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"content\": [\n      {\n        \"text\": \"12 orders are currently delayed.\",\n        \"type\": \"text\"\n      }\n    ],\n    \"isError\": false\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"2\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 184,\n  \"sse_event\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful Tool Call
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"delayed\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"content\": [\n      {\n        \"text\": \"12 orders are currently delayed.\",\n        \"type\": \"text\"\n      }\n    ],\n    \"isError\": false\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"2\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 184,\n  \"sse_event\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Successful Tool Call
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"delayed\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"content\": [\n      {\n        \"text\": \"12 orders are currently delayed.\",\n        \"type\": \"text\"\n      }\n    ],\n    \"isError\": false\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"2\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 184,\n  \"sse_event\": false\n}")
  .asString();
```

```php Successful Tool Call
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run', [
  'body' => '{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "delayed"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "content": [
      {
        "text": "12 orders are currently delayed.",
        "type": "text"
      }
    ],
    "isError": false
  },
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "2",
  "protocol_version": "2025-06-18",
  "duration_ms": 184,
  "sse_event": false
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Successful Tool Call
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"delayed\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"content\": [\n      {\n        \"text\": \"12 orders are currently delayed.\",\n        \"type\": \"text\"\n      }\n    ],\n    \"isError\": false\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"2\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 184,\n  \"sse_event\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Successful Tool Call
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "method": "tools/call",
  "request": [
    "arguments": ["status": "delayed"],
    "name": "query_orders_by_status"
  ],
  "response": [
    "content": [
      [
        "text": "12 orders are currently delayed.",
        "type": "text"
      ]
    ],
    "isError": false
  ],
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "2",
  "protocol_version": "2025-06-18",
  "duration_ms": 184,
  "sse_event": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Failed Tool Call

**Request**

```json
{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "archived"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "error": {
      "code": -32602,
      "message": "Invalid params: unknown status 'archived'"
    }
  },
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "3",
  "protocol_version": "2025-06-18",
  "duration_ms": 9,
  "sse_event": false
}
```

**Response**

```json
{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "delayed"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "content": [
      {
        "text": "12 orders are currently delayed.",
        "type": "text"
      }
    ],
    "isError": false
  },
  "id": "01990829-9213-7168-95a4-bf2a3b4c5d6f",
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "created": "2026-07-10T09:01:47Z",
  "modified": "2026-07-10T09:01:47Z",
  "request_id": "2",
  "protocol_version": "2025-06-18",
  "duration_ms": 184,
  "sse_event": false
}
```

**SDK Code**

```python Failed Tool Call
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run"

payload = {
    "method": "tools/call",
    "request": {
        "arguments": { "status": "archived" },
        "name": "query_orders_by_status"
    },
    "response": { "error": {
            "code": -32602,
            "message": "Invalid params: unknown status 'archived'"
        } },
    "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
    "request_id": "3",
    "protocol_version": "2025-06-18",
    "duration_ms": 9,
    "sse_event": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Failed Tool Call
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"method":"tools/call","request":{"arguments":{"status":"archived"},"name":"query_orders_by_status"},"response":{"error":{"code":-32602,"message":"Invalid params: unknown status \'archived\'"}},"mcp_server_id":"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e","request_id":"3","protocol_version":"2025-06-18","duration_ms":9,"sse_event":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Failed Tool Call
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run"

	payload := strings.NewReader("{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"archived\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"error\": {\n      \"code\": -32602,\n      \"message\": \"Invalid params: unknown status 'archived'\"\n    }\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"3\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 9,\n  \"sse_event\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Failed Tool Call
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"archived\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"error\": {\n      \"code\": -32602,\n      \"message\": \"Invalid params: unknown status 'archived'\"\n    }\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"3\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 9,\n  \"sse_event\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Failed Tool Call
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"archived\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"error\": {\n      \"code\": -32602,\n      \"message\": \"Invalid params: unknown status 'archived'\"\n    }\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"3\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 9,\n  \"sse_event\": false\n}")
  .asString();
```

```php Failed Tool Call
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run', [
  'body' => '{
  "method": "tools/call",
  "request": {
    "arguments": {
      "status": "archived"
    },
    "name": "query_orders_by_status"
  },
  "response": {
    "error": {
      "code": -32602,
      "message": "Invalid params: unknown status \'archived\'"
    }
  },
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "3",
  "protocol_version": "2025-06-18",
  "duration_ms": 9,
  "sse_event": false
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Failed Tool Call
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"method\": \"tools/call\",\n  \"request\": {\n    \"arguments\": {\n      \"status\": \"archived\"\n    },\n    \"name\": \"query_orders_by_status\"\n  },\n  \"response\": {\n    \"error\": {\n      \"code\": -32602,\n      \"message\": \"Invalid params: unknown status 'archived'\"\n    }\n  },\n  \"mcp_server_id\": \"0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e\",\n  \"request_id\": \"3\",\n  \"protocol_version\": \"2025-06-18\",\n  \"duration_ms\": 9,\n  \"sse_event\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Failed Tool Call
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "method": "tools/call",
  "request": [
    "arguments": ["status": "archived"],
    "name": "query_orders_by_status"
  ],
  "response": ["error": [
      "code": -32602,
      "message": "Invalid params: unknown status 'archived'"
    ]],
  "mcp_server_id": "0197a8c1-2b4c-7a91-8e3d-4f5a6b7c8d9e",
  "request_id": "3",
  "protocol_version": "2025-06-18",
  "duration_ms": 9,
  "sse_event": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/mcp_server/mcp_server_id/mcp_run")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```