Skip to main content
Glama

send_message

Send encrypted messages securely to any XMTP-enabled wallet address or ENS name using this tool. Facilitates direct communication via the XMTP decentralized messaging network.

Instructions

Send a message to an address via XMTP

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesMessage content to send
recipientYesWallet address or ENS name to send message to

Implementation Reference

  • The main handler function that executes the logic for the 'send_message' tool: validates connection, checks recipient capability, creates DM conversation, sends the message, and syncs conversations.
    private async sendMessage(args: any) { if (!this.state.client) { throw new Error("XMTP client not connected. Use connect_xmtp tool first."); } const { recipient, message } = args; try { // Create recipient identifier for XMTP operations const recipientIdentifier = { identifier: recipient, identifierKind: 0, // IdentifierKind.Ethereum }; // Check if we can message this address (try both original and lowercase) const canMessage = await this.state.client.canMessage([recipientIdentifier]); const canMessageResult = canMessage.get(recipient) || canMessage.get(recipient.toLowerCase()); if (!canMessageResult) { throw new Error(`Address ${recipient} is not on the XMTP network`); } // Create DM conversation with identifier (back to original method) const conversation = await this.state.client.conversations.newDmWithIdentifier(recipientIdentifier); // Send message await conversation.send(message); // Sync to ensure message is propagated await this.state.client.conversations.syncAll(); return { content: [ { type: "text", text: `Message sent to ${recipient}: "${message}"`, }, ], }; } catch (error) { throw new Error(`Failed to send message: ${error}`); } }
  • The input schema definition for the 'send_message' tool, specifying required 'recipient' and 'message' parameters with descriptions.
    { name: "send_message", description: "Send a message to an address via XMTP", inputSchema: { type: "object", properties: { recipient: { type: "string", description: "Wallet address or ENS name to send message to", }, message: { type: "string", description: "Message content to send", }, }, required: ["recipient", "message"], }, },
  • src/index.ts:217-218 (registration)
    The dispatch/registration case in the CallToolRequestSchema handler that routes calls to the 'send_message' tool to its handler method.
    case "send_message": return await this.sendMessage(args);

Other Tools

Related Tools

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/kwaude/xmtp-mcp'

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