Skip to content

JSON-RPC Reference โ€‹

Complete specification for Fantasy402 MCP API using JSON-RPC 2.0 protocol.

Protocol Overview โ€‹

The Fantasy402 MCP API uses JSON-RPC 2.0 for all communication. All requests and responses follow the JSON-RPC 2.0 specification.

Request Format โ€‹

json
{
  "jsonrpc": "2.0",
  "id": "unique-request-id",
  "method": "tools/call",
  "params": {
    "name": "toolName",
    "arguments": {
      // Tool-specific arguments
    }
  }
}

Request Fields โ€‹

FieldTypeRequiredDescription
jsonrpcstringYesMust be "2.0"
idstring/numberYesUnique identifier for the request
methodstringYesMust be "tools/call"
paramsobjectYesMethod parameters
params.namestringYesName of the MCP tool to execute
params.argumentsobjectYesArguments for the tool

Response Format โ€‹

Success Response โ€‹

json
{
  "jsonrpc": "2.0",
  "id": "unique-request-id",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Tool execution result"
      }
    ],
    "isError": false
  }
}

Error Response โ€‹

json
{
  "jsonrpc": "2.0",
  "id": "unique-request-id",
  "error": {
    "code": -32601,
    "message": "Tool not found",
    "data": {
      "toolName": "unknownTool"
    }
  }
}

Error Codes โ€‹

CodeMessageDescription
-32700Parse errorInvalid JSON received
-32600Invalid RequestRequest doesn't match JSON-RPC spec
-32601Method not foundUnknown method requested
-32602Invalid paramsInvalid method parameters
-32603Internal errorInternal server error
-32000Server errorTool execution failed

HTTP Transport โ€‹

Endpoint โ€‹

POST https://fantasy402-api-production.utahj4754.workers.dev/mcp

Headers โ€‹

Content-Type: application/json
Authorization: Bearer <your-api-token>

HTTP Status Codes โ€‹

StatusMeaning
200Success
400Bad Request (invalid JSON-RPC)
401Unauthorized
403Forbidden
404Not Found
500Internal Server Error

Authentication โ€‹

All requests must include proper authentication via the Authorization header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Contact your Fantasy402 representative for API credentials.

Rate Limiting โ€‹

  • Requests per minute: 1000
  • Burst limit: 2000
  • Refill rate: 16.67 tokens/ms

Rate limit headers are included in responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1640995200

Examples โ€‹

Successful Tool Call โ€‹

Request:

json
{
  "jsonrpc": "2.0",
  "id": "req-123",
  "method": "tools/call",
  "params": {
    "name": "getActiveAccounts",
    "arguments": {
      "limit": 10
    }
  }
}

Response:

json
{
  "jsonrpc": "2.0",
  "id": "req-123",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "[{\"id\":\"123\",\"balance\":1500.00,\"status\":\"active\"}]"
      }
    ],
    "isError": false
  }
}

Error Response โ€‹

Request:

json
{
  "jsonrpc": "2.0",
  "id": "req-456",
  "method": "tools/call",
  "params": {
    "name": "unknownTool",
    "arguments": {}
  }
}

Response:

json
{
  "jsonrpc": "2.0",
  "id": "req-456",
  "error": {
    "code": -32601,
    "message": "Tool 'unknownTool' not found",
    "data": {
      "availableTools": ["getActiveAccounts", "getCustomerData", ...]
    }
  }
}