Skip to main content
Glama

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
NameRequiredDescriptionDefault
media_idYesInstagram media ID
metricsNoSpecific metrics to retrieve (optional, gets all if not specified). Note: video_views only works for video posts

Implementation Reference

  • 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 ?? [];
    }
  • 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);
    }
  • 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"],
      },
    },

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/mcpware/instagram-mcp'

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