Skip to main content
Glama

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
NameRequiredDescriptionDefault
media_idYesMedia ID
enabledYestrue to enable comments, false to disable

Implementation Reference

  • 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 };
        }
      }
    );

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/mikusnuz/meta-mcp'

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