ig_get_comment
Retrieve details of a specific Instagram comment using its comment ID. Access the comment text, author information, timestamp, and engagement data via the Meta Graph API.
Instructions
Get details of a specific comment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment_id | Yes | Comment ID |
Implementation Reference
- src/tools/instagram/comments.ts:30-47 (handler)The handler/registration for the ig_get_comment tool. Calls MetaClient.ig('GET', `/${comment_id}`) to fetch comment details with fields: id, text, username, timestamp, like_count, parent_id, media.
// ─── ig_get_comment ────────────────────────────────────────── server.tool( "ig_get_comment", "Get details of a specific comment.", { comment_id: z.string().describe("Comment ID"), }, async ({ comment_id }) => { try { const { data, rateLimit } = await client.ig("GET", `/${comment_id}`, { fields: "id,text,username,timestamp,like_count,parent_id,media", }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get comment failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/instagram/comments.ts:30-47 (registration)The tool is registered via server.tool() in the registerIgCommentTools function, which is called from index.ts at line 44.
// ─── ig_get_comment ────────────────────────────────────────── server.tool( "ig_get_comment", "Get details of a specific comment.", { comment_id: z.string().describe("Comment ID"), }, async ({ comment_id }) => { try { const { data, rateLimit } = await client.ig("GET", `/${comment_id}`, { fields: "id,text,username,timestamp,like_count,parent_id,media", }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get comment failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/services/meta-client.ts:76-85 (helper)The MetaClient.ig() helper method that makes the actual API request to the Instagram Graph API (graph.facebook.com/v25.0).
async ig( method: string, path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { if (!this.config.instagramAccessToken) { throw new Error("INSTAGRAM_ACCESS_TOKEN is not configured."); } return this.request(IG_BASE, this.config.instagramAccessToken, method, path, params); }