Send a PyGen MCP request

POST https://{controlplane_path}/api/1/rest/public/platform_mcp/mcp/pygen

Overview

This API sends a JSON-RPC 2.0 request to the Platform MCP Server using the PyGen toolset and returns the response as a Server-Sent Events (SSE) stream.

Use this endpoint to initialize a PyGen toolset session, list available tools, and invoke them to query the Snap knowledge base and validate pipeline designs. All requests and responses follow the JSON-RPC 2.0 specification.

Prerequisites

  • Read access to the requested assets

Request

POST https://{controlplane_path}/api/1/rest/public/platform_mcp/mcp/pygen
      

Path parameters

Key Description
controlplane_path Required. The SnapLogic control plane host: elastic.snaplogic.com (US) or emea.snaplogic.com (EU).

Request headers

Key Type Description
Authorization String Required. HTTP Basic credentials. Refer to MCP APIs — Authentication for format details. Forwarded verbatim to the SnapLogic MCP Server for per-request authentication.
Content-Type String Required. Must be application/json.
Mcp-Session-Id String Optional. Session identifier returned by the initialize response. Required for all requests after the initial initialize call. Omit on the first request.

Request body

A JSON-RPC 2.0 request object:

Key Type Description
jsonrpc String Required. Must be "2.0".
id Integer or String Required. for requests; omit for notifications. A unique identifier used to correlate the response. Must be omitted when method is notifications/initialized.
method String Required. The MCP method to invoke. Supported values:
  • initialize — Start a new MCP session and negotiate capabilities.
  • notifications/initialized — Confirm the handshake is complete. This is a JSON-RPC notification; omit the id field.
  • tools/list — List available PyGen tools.
  • tools/call — Invoke a specific PyGen tool.
params Object Optional. Parameters for the method. For tools/call, provide name (the tool name) and arguments (tool-specific inputs). Use tools/list to discover the tools available in the current session. See Examples.

Response headers

Key Type Description
Mcp-Session-Id String Returned on a successful initialize response. Include this value in the Mcp-Session-Id request header for all subsequent requests in the session.

Response body

Responses are delivered as Server-Sent Events (SSE). Each event carries a JSON-RPC 2.0 response object in the data field:

event: message
data: {"jsonrpc": "2.0", "id": 1, "result": { ... }}

HTTP status codes:

Key Description
200 OK The request was forwarded and the SSE stream contains the response.
400 Bad Request The request body is malformed or a required field is missing.
401 Unauthorized The request is missing a valid Authorization header.
403 Forbidden The authenticated user doesn't have permission to access the requested organization or resource.
502 Bad Gateway The SnapLogic MCP Server is unreachable.
504 Gateway Timeout The SnapLogic MCP Server did not respond within the timeout period.

Examples

Step 1: Initialize a session

POST https://elastic.snaplogic.com/api/1/rest/public/platform_mcp/mcp/pygen
Authorization: Basic <base64_credentials>
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-03-26",
    "capabilities": {},
    "clientInfo": { "name": "my-client", "version": "1.0" }
  }
}

The server responds with its capabilities and returns the Mcp-Session-Id in the response header. Use this session ID in all subsequent requests.

Step 2: Confirm the handshake

POST https://elastic.snaplogic.com/api/1/rest/public/platform_mcp/mcp/pygen
Authorization: Basic <base64_credentials>
Content-Type: application/json
Mcp-Session-Id: <session_id>

{
  "jsonrpc": "2.0",
  "method": "notifications/initialized"
}

This is a JSON-RPC notification — omit the id field. The server does not send a response. The session is now fully initialized.

Step 3: List available tools

POST https://elastic.snaplogic.com/api/1/rest/public/platform_mcp/mcp/pygen
Authorization: Basic <base64_credentials>
Content-Type: application/json
Mcp-Session-Id: <session_id>

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list",
  "params": {}
}

Step 4: Call a PyGen tool

POST https://elastic.snaplogic.com/api/1/rest/public/platform_mcp/mcp/pygen
Authorization: Basic <base64_credentials>
Content-Type: application/json
Mcp-Session-Id: <session_id>

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "pygen_get_snap_documentation",
    "arguments": {
      "snap_names": ["Mapper", "JSON Formatter", "REST Get"]
    }
  }
}