Skip to main content
Glama

stream_messages

Stream real-time messages from XMTP conversations to monitor incoming communications and respond promptly to decentralized messaging network activity.

Instructions

Start streaming new messages from all conversations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
callbackNoOptional callback function name for message handling

Implementation Reference

  • The handler function that executes the stream_messages tool. It starts a stream of all XMTP conversations, collects up to 10 recent messages, and returns them in the response.
    private async streamMessages(args: any) {
      if (!this.state.client) {
        throw new Error("XMTP client not connected. Use connect_xmtp tool first.");
      }
    
      try {
        // Start streaming all messages
        const stream = await this.state.client.conversations.streamAllMessages();
        
        let messageCount = 0;
        const messages: any[] = [];
    
        // Collect first few messages for demonstration
        for await (const message of stream) {
          messages.push({
            id: message.id,
            sender: message.senderInboxId,
            content: message.content,
            timestamp: message.sentAt?.toISOString(),
            conversationId: message.conversationId,
          });
          
          messageCount++;
          if (messageCount >= 10) break; // Limit for demonstration
        }
    
        return {
          content: [
            {
              type: "text", 
              text: `Started streaming messages. Recent messages:\n${JSON.stringify(messages, null, 2)}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to stream messages: ${error}`);
      }
    }
  • The input schema definition for the stream_messages tool, defining an optional callback parameter.
    inputSchema: {
      type: "object",
      properties: {
        callback: {
          type: "string",
          description: "Optional callback function name for message handling",
        },
      },
    },
  • src/index.ts:191-203 (registration)
    Registration of the stream_messages tool in the ListTools response, including name, description, and schema.
    {
      name: "stream_messages",
      description: "Start streaming new messages from all conversations",
      inputSchema: {
        type: "object",
        properties: {
          callback: {
            type: "string",
            description: "Optional callback function name for message handling",
          },
        },
      },
    },
  • src/index.ts:229-231 (registration)
    Dispatch/registration in the CallTool handler switch statement that routes to the streamMessages method.
    case "stream_messages":
      return await this.streamMessages(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. While 'Start streaming' implies a long-running or real-time operation, it doesn't describe what 'streaming' entails (e.g., continuous data flow, event-driven updates), how to handle the stream, termination conditions, or potential side effects like resource consumption or network usage.

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 that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resource, making it immediately clear what the tool does.

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 streaming tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'streaming' returns (e.g., real-time message objects, event streams), how to interact with the stream, or important behavioral aspects like error handling or cleanup requirements, leaving significant gaps for agent understanding.

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%, with the single parameter 'callback' fully documented in the schema. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline for adequate but unremarkable 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 ('Start streaming') and target resource ('new messages from all conversations'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_messages' (which presumably retrieves existing messages rather than streaming new ones), so it doesn't reach the highest 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 like 'get_messages' or 'send_message'. It doesn't mention prerequisites (e.g., whether 'connect_xmtp' must be called first) or appropriate contexts for streaming versus other message operations.

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