ig_toggle_comments
Control comment visibility on Instagram posts by enabling or disabling them using the media ID.
Instructions
Enable or disable comments on an Instagram media post.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | Media ID | |
| enabled | Yes | true to enable comments, false to disable |
Implementation Reference
- src/tools/instagram/media.ts:87-104 (handler)The tool 'ig_toggle_comments' is registered and implemented within the 'registerIgMediaTools' function in 'src/tools/instagram/media.ts'. It uses the MetaClient to perform a POST request to toggle comments on an Instagram media post.
server.tool( "ig_toggle_comments", "Enable or disable comments on an Instagram media post.", { media_id: z.string().describe("Media ID"), enabled: z.boolean().describe("true to enable comments, false to disable"), }, async ({ media_id, enabled }) => { try { const { data, rateLimit } = await client.ig("POST", `/${media_id}`, { comment_enabled: enabled, }); return { content: [{ type: "text", text: JSON.stringify({ success: true, comment_enabled: enabled, ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Toggle comments failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );