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
| Name | Required | Description | Default |
|---|---|---|---|
| page_id | No | Facebook page ID (optional, auto-detected) | |
| limit | No | Number of conversations (max 100) |
Implementation Reference
- src/client.ts:417-437 (handler)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 }, }, - src/index.ts:407-410 (handler)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); }