Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier
dataYesData payload to send

Implementation Reference

  • 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}`
        };
      }
    }
  • 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: {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aj-bartocci/SpyNet'

If you have feedback or need assistance with the MCP directory API, please join our Discord server