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
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | Comma-separated metrics: views,reach,follower_count,reposts,accounts_engaged,total_interactions | |
| period | Yes | Aggregation period | |
| since | No | Start date (Unix timestamp or ISO 8601) | |
| until | No | End date (Unix timestamp or ISO 8601) |
Implementation Reference
- src/tools/instagram/profile.ts:24-44 (handler)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 }; } } ); - src/tools/instagram/profile.ts:27-32 (schema)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)"), }, - src/tools/instagram/profile.ts:24-24 (registration)Registration of the `ig_get_account_insights` tool within the MCP server.
server.tool(