Skip to main content
Glama

send_message

Send encrypted messages to wallet addresses or ENS names through the XMTP decentralized messaging network.

Instructions

Send a message to an address via XMTP

Input Schema

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

Implementation Reference

  • The primary handler function for the 'send_message' tool. It checks if the XMTP client is connected, validates the recipient can receive messages, creates a direct message conversation, sends the message, syncs conversations, and returns a success response.
    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 and metadata for the 'send_message' tool, defining the required 'recipient' and 'message' parameters as strings.
    {
      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 switch case registration in the CallToolRequestSchema handler that routes 'send_message' tool calls to the sendMessage method.
    case "send_message":
      return await this.sendMessage(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool sends a message but doesn't cover critical traits like whether it's a write operation, authentication requirements, rate limits, error handling, or what happens on success/failure. This leaves significant gaps for a tool that performs an action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that performs a write action (sending a message) with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits, response format, error conditions, and integration with sibling tools, making it inadequate for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents both parameters ('recipient' and 'message') adequately. The description adds no additional parameter semantics beyond what the schema provides, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('send a message') and target ('to an address via XMTP'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_messages' or 'stream_messages', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to connect via 'connect_xmtp' first), appropriate contexts, or exclusions, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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