Skip to main content
Glama

get_conversations

Retrieve Instagram direct message conversations from the Graph API. Manage and access DMs with page-level permissions for message handling.

Instructions

Get Instagram DM conversations. Requires instagram_manage_messages permission.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idNoFacebook page ID (optional, auto-detected)
limitNoNumber of conversations (max 100)

Implementation Reference

  • The actual implementation of the tool logic that fetches conversations from the Instagram API.
    async getConversations(
      pageId?: string,
      limit = 25
    ): Promise<IGConversation[]> {
      let pid = pageId;
      if (!pid) {
        const pages = await this.getAccountPages();
        if (!pages.length)
          throw new InstagramAPIError("No Facebook pages found");
        pid = pages[0].id;
      }
      const data = await this.request("GET", `${pid}/conversations`, {
        params: {
          platform: "instagram",
          fields: "id,updated_time,message_count",
          limit: String(Math.min(limit, 100)),
        },
        useFacebookApi: true,
      });
      return data.data ?? [];
    }
  • src/index.ts:177-186 (registration)
    MCP tool definition/registration for "get_conversations".
    {
      name: "get_conversations",
      description:
        "Get Instagram DM conversations. Requires instagram_manage_messages permission.",
      inputSchema: {
        type: "object" as const,
        properties: {
          page_id: { type: "string", description: "Facebook page ID (optional, auto-detected)" },
          limit: { type: "integer", description: "Number of conversations (max 100)", minimum: 1, maximum: 100, default: 25 },
        },
  • MCP request handler case that calls the client implementation for "get_conversations".
    case "get_conversations": {
      const convos = await c.getConversations(args.page_id, args.limit ?? 25);
      return JSON.stringify({ conversations: convos, count: convos.length }, null, 2);
    }

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/mcpware/instagram-mcp'

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