Skip to main content
Glama

get_post_analytics

Get published posts and their key metrics: impressions, reach, likes, comments, shares. Supports Instagram, Facebook, TikTok, Threads, YouTube, LinkedIn company pages, and Pinterest business accounts. Filter by date range.

Instructions

Fetch published posts with their latest performance metrics (impressions, reach, likes, comments, shares). Only returns published posts that have a platform post ID. LinkedIn personal accounts are excluded. Supported: Instagram, Facebook, TikTok, Threads, YouTube, LinkedIn (company pages), Pinterest (Business accounts). Pinterest extras include pin_clicks, outbound_clicks, saves_90d, save_rate_90d (saves are 90-day rolling because Pinterest API does not expose lifetime totals); video pins additionally surface mrc_views, views_10s, avg_watch_time, v50_watch_time, video_starts, quartile_95_views.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStart of date range (ISO 8601, e.g. 2026-01-01T00:00:00.000Z)
endDateYesEnd of date range (ISO 8601, e.g. 2026-01-31T23:59:59.999Z)
platformsNoFilter by platforms
socialMediaIdsNoFilter by specific social media account IDs

Implementation Reference

  • The async handler function that executes the 'get_post_analytics' tool logic. Calls client.get<AnalyticsResponse>('/social-posts/analytics', ...) with startDate, endDate, optional platforms, and optional socialMediaIds query parameters, then returns the JSON-stringified response.
      async (input) => {
        const data = await client.get<AnalyticsResponse>('/social-posts/analytics', {
          startDate: input.startDate,
          endDate: input.endDate,
          platforms: input.platforms?.join(','),
          socialMediaIds: input.socialMediaIds?.join(','),
        });
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      },
    );
  • Zod schema definitions for the 'get_post_analytics' input parameters: startDate (ISO 8601 string), endDate (ISO 8601 string), optional platforms (array of platform enum values), optional socialMediaIds (array of UUID strings).
      startDate: z
        .string()
        .describe('Start of date range (ISO 8601, e.g. 2026-01-01T00:00:00.000Z)'),
      endDate: z
        .string()
        .describe('End of date range (ISO 8601, e.g. 2026-01-31T23:59:59.999Z)'),
      platforms: z
        .array(z.enum(PLATFORMS))
        .optional()
        .describe('Filter by platforms'),
      socialMediaIds: z
        .array(z.string().uuid())
        .optional()
        .describe('Filter by specific social media account IDs'),
    },
  • Registration of the 'get_post_analytics' tool via server.tool() with its name, description, input schema, and handler.
    server.tool(
      'get_post_analytics',
      'Fetch published posts with their latest performance metrics (impressions, reach, likes, comments, shares). Only returns published posts that have a platform post ID. LinkedIn personal accounts are excluded. Supported: Instagram, Facebook, TikTok, Threads, YouTube, LinkedIn (company pages), Pinterest (Business accounts). Pinterest extras include pin_clicks, outbound_clicks, saves_90d, save_rate_90d (saves are 90-day rolling because Pinterest API does not expose lifetime totals); video pins additionally surface mrc_views, views_10s, avg_watch_time, v50_watch_time, video_starts, quartile_95_views.',
      {
        startDate: z
          .string()
          .describe('Start of date range (ISO 8601, e.g. 2026-01-01T00:00:00.000Z)'),
        endDate: z
          .string()
          .describe('End of date range (ISO 8601, e.g. 2026-01-31T23:59:59.999Z)'),
        platforms: z
          .array(z.enum(PLATFORMS))
          .optional()
          .describe('Filter by platforms'),
        socialMediaIds: z
          .array(z.string().uuid())
          .optional()
          .describe('Filter by specific social media account IDs'),
      },
      async (input) => {
        const data = await client.get<AnalyticsResponse>('/social-posts/analytics', {
          startDate: input.startDate,
          endDate: input.endDate,
          platforms: input.platforms?.join(','),
          socialMediaIds: input.socialMediaIds?.join(','),
        });
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      },
    );
  • PostMetric interface defining the shape of individual post metrics returned by the analytics endpoint (impressions, reach, likes, comments, shares, totalInteractions, fetchedAt, extras).
    export interface PostMetric {
      impressions: string;
      reach: string;
      likes: string;
      comments: string;
      shares: string;
      totalInteractions: string;
      fetchedAt: string;
      extras: Record<string, unknown>;
    }
  • AnalyticsPost and AnalyticsResponse interfaces defining the shape of the API response for the analytics endpoint.
    export interface AnalyticsPost {
      id: string;
      content: string;
      socialMediaId: string;
      platformPostId: string;
      publishedAt: string;
      latestMetric: PostMetric | null;
    }
    
    export interface AnalyticsResponse {
      data: AnalyticsPost[];
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that it returns only published posts with platform post IDs and excludes certain accounts. It details Pinterest-specific metrics and rolling window behavior. No contradictions are present, though rate limits or authentication are not mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently front-loaded with the main purpose and essential details. It is structured with clear sections for supported platforms and Pinterest extras, every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (multiple platforms, varied metrics), the description is thorough. It explains what metrics are returned for each platform, highlights special cases (Pinterest 90-day rolling), and specifies exclusion rules. No output schema exists, so the description compensates well.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage, so the baseline is 3. The description adds value by explaining the meaning of return metrics and how platforms affect results, which indirectly informs parameter usage. It provides context beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool's function: fetching published posts with performance metrics. It specifies supported platforms and exclusions, differentiating it from sibling tools like list_posts which only list posts without analytics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states constraints (only published posts with platform post ID, excludes LinkedIn personal accounts) and lists supported platforms. Although it doesn't directly compare to alternatives, the context is sufficient for an agent to decide when to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/peturgeorgievv-factory/postfast-mcp'

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