Skip to main content
Glama

list_conversations

Retrieve all active XMTP conversations to manage decentralized messaging interactions.

Instructions

List all active XMTP conversations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_conversations' tool. It checks if the XMTP client is connected, lists all conversations using client.conversations.list(), maps them to a simple object with id and createdAt, formats as JSON, and returns it wrapped in the MCP response format.
    private async listConversations() {
      if (!this.state.client) {
        throw new Error("XMTP client not connected. Use connect_xmtp tool first.");
      }
    
      try {
        const conversations = await this.state.client.conversations.list();
        
        const conversationList = conversations.map((conv) => {
          return {
            id: conv.id,
            createdAt: conv.createdAt?.toISOString(),
          }
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(conversationList, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to list conversations: ${error}`);
      }
    }
  • The input schema for the 'list_conversations' tool, which takes no parameters (empty properties).
    inputSchema: {
      type: "object",
      properties: {},
    },
  • src/index.ts:169-176 (registration)
    The tool registration object defining the name, description, and input schema for 'list_conversations' within the tools array passed to setTools.
    {
      name: "list_conversations",
      description: "List all active XMTP conversations",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:223-224 (registration)
    The switch case in the tool request handler that dispatches calls to the 'list_conversations' handler function.
    case "list_conversations":
      return await this.listConversations();

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