Skip to main content
Glama

send_message

Send a message to the VRChat chatbox directly or populate it for later use. Enables AI-driven interactions in virtual reality environments.

Instructions

Send a message to the VRChat chatbox.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesMessage to send
send_immediatelyNoSend immediately or just populate chatbox

Implementation Reference

  • MCP tool registration for 'send_message', including inline schema (Zod) and handler function that delegates to inputTools.sendChatboxMessage
    server.tool(
      'send_message',
      'Send a message to the VRChat chatbox.',
      {
        message: z.string().describe('Message to send'),
        send_immediately: z.boolean().default(true).describe('Send immediately or just populate chatbox')
      },
      async ({ message, send_immediately }, extra) => {
        try {
          const ctx = createToolContext(extra);
          const result = await inputTools.sendChatboxMessage(message, send_immediately, ctx);
          return { content: [{ type: 'text', text: result }] };
        } catch (error) {
          return { 
            content: [{ 
              type: 'text', 
              text: `Error sending message: ${error instanceof Error ? error.message : String(error)}` 
            }],
            isError: true
          };
        }
      }
    );
  • Core handler logic in InputTools.sendChatboxMessage, wraps wsClient call and provides user feedback
    public async sendChatboxMessage(
      message: string,
      sendImmediately: boolean = true,
      ctx?: ToolContext
    ): Promise<string> {
      if (ctx) {
        await ctx.info(`Sending message: "${message}" (immediate: ${sendImmediately})`);
      }
    
      try {
        const success = await this.wsClient.sendChatboxMessage(message, sendImmediately);
        if (success) {
          return `Message sent: "${message}"`;
        } else {
          return `Failed to send message: "${message}"`;
        }
      } catch (error) {
        const errorMsg = `Error sending message: ${error instanceof Error ? error.message : String(error)}`;
        logger.error(errorMsg);
        return errorMsg;
      }
    }
  • WebSocket client method that sends 'chatbox/sendMessage' RPC to relay server
    public async sendChatboxMessage(
      message: string,
      sendImmediately: boolean = true,
      notification: boolean = true
    ): Promise<boolean> {
      const response = await this.sendRequest<{ success: boolean }>('chatbox/sendMessage', {
        message,
        immediate: sendImmediately,
        notification
      });
      this.logger.info(`Chatbox message response: ${JSON.stringify(response)}`);
      return response.success;
    }
  • Relay server RPC handler for 'chatbox/sendMessage' that delegates to oscClient.send_chatbox
    case 'chatbox/sendMessage':
      // Send a chatbox message
      const message = data.message as string;
      const sendImmediately = data.immediate as boolean ?? true;
      const notification = data.notification as boolean ?? true;
    
      if (!message) {
        response.error = { message: 'Missing message text' };
      } else {
        const result = this.oscClient.send_chatbox(message, sendImmediately, notification);
        response.data = { success: result };
      }
      break;

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/Krekun/vrchat-mcp-osc'

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