get_media_insights
Retrieve detailed analytics for Instagram posts including reach, likes, comments, shares, saves, and video views to measure content performance.
Instructions
Get detailed insights and analytics for a specific Instagram post
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | Instagram media ID | |
| metrics | No | Specific metrics to retrieve (optional, gets all if not specified). Note: video_views only works for video posts |
Implementation Reference
- src/client.ts:273-281 (handler)The core implementation of the media insights retrieval logic in the API client.
async getMediaInsights( mediaId: string, metrics?: string[] ): Promise<IGInsight[]> { const defaultMetrics = ["reach", "likes", "comments", "shares", "saved"]; const params = { metric: (metrics ?? defaultMetrics).join(",") }; const data = await this.request("GET", `${mediaId}/insights`, { params }); return data.data ?? []; } - src/index.ts:360-363 (handler)The MCP tool handler that invokes the API client for get_media_insights.
case "get_media_insights": { const insights = await c.getMediaInsights(args.media_id, args.metrics); return JSON.stringify({ media_id: args.media_id, insights }, null, 2); } - src/index.ts:81-97 (schema)The MCP schema definition for the get_media_insights tool.
{ name: "get_media_insights", description: "Get detailed insights and analytics for a specific Instagram post", inputSchema: { type: "object" as const, properties: { media_id: { type: "string", description: "Instagram media ID" }, metrics: { type: "array", items: { type: "string", enum: ["reach", "likes", "comments", "shares", "saved", "video_views"] }, description: "Specific metrics to retrieve (optional, gets all if not specified). Note: video_views only works for video posts", }, }, required: ["media_id"], }, },