send_websocket_data
Send data payloads to connected WebSocket clients in SpyNet mock servers for real-time communication during application testing and development.
Instructions
Send a data message to connected WebSocket client
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>",
"data": "<data>"
},
"name": "send_websocket_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session identifier | |
| data | Yes | Data payload to send |
Implementation Reference
- src/mcp/tools.ts:188-215 (handler)Implementation of the send_websocket_data tool handler.
send_websocket_data: async (args: any) => { try { const { sessionId, data } = args; if (!sessionId || data === undefined) { return { success: false, error: 'Missing required fields: sessionId, data' }; } const sent = wsHub.sendData(sessionId, data); if (!sent) { return { success: false, error: 'No active connection for session' }; } return { success: true }; } catch (error: any) { return { success: false, error: `Failed to send data: ${error.message}` }; } } - src/mcp/server.ts:166-175 (registration)Registration and schema definition for the send_websocket_data tool.
name: 'send_websocket_data', description: 'Send a data message to connected WebSocket client', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier', }, data: {