ig_get_conversations
Retrieve Instagram direct message conversations from the inbox or spam folder using the Instagram Messaging API. Supports pagination and conversation limits for organized message management.
Instructions
Get Instagram DM conversations list. Requires 'instagram_manage_messages' permission and the Instagram Messaging API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder | No | Folder to retrieve (default: inbox) | |
| limit | No | Number of conversations | |
| after | No | Pagination cursor |
Implementation Reference
- src/tools/instagram/messaging.ts:7-30 (handler)The implementation of the 'ig_get_conversations' MCP tool. It validates inputs via zod, constructs the API parameters, and calls the MetaClient's ig method to fetch conversation data.
server.tool( "ig_get_conversations", "Get Instagram DM conversations list. Requires 'instagram_manage_messages' permission and the Instagram Messaging API.", { folder: z.enum(["inbox", "spam"]).optional().describe("Folder to retrieve (default: inbox)"), limit: z.number().optional().describe("Number of conversations"), after: z.string().optional().describe("Pagination cursor"), }, async ({ folder, limit, after }) => { try { const params: Record<string, unknown> = { platform: "instagram", fields: "id,updated_time,participants,messages{id,message,from,created_time}", }; if (folder) params.folder = folder; if (limit) params.limit = limit; if (after) params.after = after; const { data, rateLimit } = await client.ig("GET", `/${client.igUserId}/conversations`, params); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get conversations failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );