Skip to main content
Glama

ig_get_account_insights

Retrieve Instagram account performance metrics including views, reach, follower count, and engagement data for specified time periods.

Instructions

Get Instagram account insights. Note: 'impressions', 'email_contacts', 'phone_call_clicks', 'text_message_clicks', 'get_directions_clicks', 'website_clicks', 'profile_views' were deprecated in v22.0. Use 'views', 'reach', 'follower_count', 'reposts' instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricYesComma-separated metrics: views,reach,follower_count,reposts,accounts_engaged,total_interactions
periodYesAggregation period
sinceNoStart date (Unix timestamp or ISO 8601)
untilNoEnd date (Unix timestamp or ISO 8601)

Implementation Reference

  • The handler implementation for the `ig_get_account_insights` tool. It takes parameters, makes a call to the Meta client's `ig` method, and returns the response.
    server.tool(
      "ig_get_account_insights",
      "Get Instagram account insights. Note: 'impressions', 'email_contacts', 'phone_call_clicks', 'text_message_clicks', 'get_directions_clicks', 'website_clicks', 'profile_views' were deprecated in v22.0. Use 'views', 'reach', 'follower_count', 'reposts' instead.",
      {
        metric: z.string().describe("Comma-separated metrics: views,reach,follower_count,reposts,accounts_engaged,total_interactions"),
        period: z.enum(["day", "week", "days_28", "month", "lifetime"]).describe("Aggregation period"),
        since: z.string().optional().describe("Start date (Unix timestamp or ISO 8601)"),
        until: z.string().optional().describe("End date (Unix timestamp or ISO 8601)"),
      },
      async ({ metric, period, since, until }) => {
        try {
          const params: Record<string, unknown> = { metric, period };
          if (since) params.since = since;
          if (until) params.until = until;
          const { data, rateLimit } = await client.ig("GET", `/${client.igUserId}/insights`, params);
          return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Get account insights failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Input validation schema for the `ig_get_account_insights` tool using Zod.
    {
      metric: z.string().describe("Comma-separated metrics: views,reach,follower_count,reposts,accounts_engaged,total_interactions"),
      period: z.enum(["day", "week", "days_28", "month", "lifetime"]).describe("Aggregation period"),
      since: z.string().optional().describe("Start date (Unix timestamp or ISO 8601)"),
      until: z.string().optional().describe("End date (Unix timestamp or ISO 8601)"),
    },
  • Registration of the `ig_get_account_insights` tool within the MCP server.
    server.tool(

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