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

# Making Requests

> JSON-RPC 2.0 request format for calling MCP servers and tools

HTTP POST with JSON-RPC 2.0. Base URL: `https://mcp.app.pinkfish.ai`. Requires a [runtime token](/api-reference/platform/authentication).

## Request Flow

| You know\...    | Use                                                                                                        |
| --------------- | ---------------------------------------------------------------------------------------------------------- |
| Tool and server | `tools/call` on server path (e.g. `/web-search`, `/gmail`)                                                 |
| Task, not tool  | [Discovery](/api-reference/platform/discovery): `capabilities_discover` → `capability_details` → call tool |

## Request Format

All requests use this structure:

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/<server-path>" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "<method>",
    "params": {
      "name": "<tool_name>",
      "arguments": { ... }
    },
    "id": 1
  }'
```

**Required headers:**

| Header          | Value                    |
| --------------- | ------------------------ |
| `Authorization` | `Bearer <runtime_token>` |
| `Content-Type`  | `application/json`       |
| `Accept`        | `application/json`       |

**JSON-RPC fields:**

| Field     | Description                                                                                     |
| --------- | ----------------------------------------------------------------------------------------------- |
| `jsonrpc` | Always `"2.0"`                                                                                  |
| `method`  | The JSON-RPC method — typically `"tools/call"` or `"tools/list"`                                |
| `params`  | Method parameters — for `tools/call`, includes `name` (tool name) and `arguments` (tool inputs) |
| `id`      | Request identifier (any integer)                                                                |

## List Servers

Query available servers and their tools:

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/mcp" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "listServers",
      "arguments": {}
    },
    "id": 1
  }'
```

**Response:** `result.structuredContent` or `result.content[0].text`. Each server has `name`, `path`, `description`, `embedded`, `tools`.

## List Tools

Call `tools/list` on a server path to see its tools:

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/gmail" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "id": 1
  }'
```

**Response:**

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "gmail_search_emails",
        "description": "Search emails in Gmail",
        "inputSchema": {
          "type": "object",
          "properties": {
            "PCID": {
              "type": "string",
              "description": "PinkConnect connection ID"
            },
            "query": { "type": "string", "description": "Gmail search query" }
          },
          "required": ["PCID", "query"]
        }
      }
    ]
  }
}
```

## Call a Tool

POST `tools/call` to the server path with the tool name and arguments:

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/<server-path>" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "<tool_name>",
      "arguments": {
        "key": "value"
      }
    },
    "id": 1
  }'
```

### Example: Search the Web

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/web-search" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "search_googlesearch",
      "arguments": {
        "q": "latest AI news"
      }
    },
    "id": 1
  }'
```

### Example: External Service (Gmail)

Requires a PCID. See [Connecting to MCPs](/api-reference/platform/connections).

```bash theme={null}
curl -s -X POST "https://mcp.app.pinkfish.ai/gmail" \
  -H "Authorization: Bearer $PINKFISH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "gmail_search_emails",
      "arguments": {
        "PCID": "abc123-def456",
        "query": "is:unread"
      }
    },
    "id": 1
  }'
```

## Response Format

**Success:** `result.structuredContent` (preferred) or `result.content[0].text` (JSON string).

```javascript theme={null}
const data = result.structuredContent ?? JSON.parse(result?.content?.[0]?.text ?? "{}");
```

**Errors:** `-32000` (validation, timeout, unsupported media) or `-32603` (internal). Ensure `Accept: application/json` and `Content-Type: application/json` are set.
