send_websocket_action
Send action messages to WebSocket clients for real-time communication in application testing and development.
Instructions
Send an action 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>",
"action": "<action>"
},
"name": "send_websocket_action"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session identifier | |
| action | Yes | Action name (e.g., logout, navigate) | |
| params | No | Optional action parameters |
Implementation Reference
- src/mcp/tools.ts:159-185 (handler)The handler implementation for the 'send_websocket_action' tool. It validates the input arguments and delegates to 'wsHub.sendAction'.
send_websocket_action: async (args: any) => { try { const { sessionId, action, params } = args; if (!sessionId || !action) { return { success: false, error: 'Missing required fields: sessionId, action' }; } const sent = wsHub.sendAction(sessionId, action, params); if (!sent) { return { success: false, error: 'No active connection for session' }; } return { success: true }; } catch (error: any) { return { success: false, error: `Failed to send action: ${error.message}` }; } - src/mcp/server.ts:143-163 (registration)Registration and input schema definition for the 'send_websocket_action' tool.
{ name: 'send_websocket_action', description: 'Send an action message to connected WebSocket client', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier', }, action: { type: 'string', description: 'Action name (e.g., logout, navigate)', }, params: { type: 'object', description: 'Optional action parameters', }, }, required: ['sessionId', 'action'], },