Skip to main content
Glama
jginorio

Sprout Social MCP Server

by jginorio

get_post_analytics

Retrieve post-level analytics including impressions and engagements for a specified date range. Supports pagination to access all posts.

Instructions

Get post-level analytics (impressions, engagements, etc.) for posts within a date range. Supports pagination — always check paging.total_pages in the response and pull all pages. IMPORTANT: The page parameter must be in the request body, not as a URL query parameter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profile_idsYesArray of customer_profile_id values to filter posts by.
metricsYesMetrics to retrieve. Valid options: 'lifetime.impressions', 'lifetime.engagements', 'lifetime.reactions', 'lifetime.video_views'. Do NOT request: 'lifetime.comments', 'lifetime.shares', 'lifetime.reach' (these are invalid).
created_time_startYesStart of the date range in ISO 8601 format (e.g. '2026-03-23T00:00:00').
created_time_endYesEnd of the date range in ISO 8601 format (e.g. '2026-03-30T00:00:00').
fieldsNoAdditional fields to include. Valid: 'created_time', 'perma_link', 'text', 'post_type'. Defaults to all if omitted.
pageNoPage number (default: 1). Must be in request body, NOT URL.

Implementation Reference

  • src/index.ts:214-214 (registration)
    Registration of the 'get_post_analytics' tool with its name, description, and schema definition.
    server.tool(
  • Input schema for get_post_analytics: profile_ids, metrics, created_time_start/end, fields (optional), page (optional). Validated with Zod.
    {
      profile_ids: z
        .array(z.string())
        .describe("Array of customer_profile_id values to filter posts by."),
      metrics: z
        .array(z.string())
        .describe(
          "Metrics to retrieve. Valid options: 'lifetime.impressions', 'lifetime.engagements', " +
            "'lifetime.reactions', 'lifetime.video_views'. " +
            "Do NOT request: 'lifetime.comments', 'lifetime.shares', 'lifetime.reach' (these are invalid)."
        ),
      created_time_start: z
        .string()
        .describe(
          "Start of the date range in ISO 8601 format (e.g. '2026-03-23T00:00:00')."
        ),
      created_time_end: z
        .string()
        .describe(
          "End of the date range in ISO 8601 format (e.g. '2026-03-30T00:00:00')."
        ),
      fields: z
        .array(z.string())
        .optional()
        .describe(
          "Additional fields to include. Valid: 'created_time', 'perma_link', 'text', 'post_type'. " +
            "Defaults to all if omitted."
        ),
      page: z
        .number()
        .optional()
        .describe("Page number (default: 1). Must be in request body, NOT URL."),
    },
  • Handler function that builds the request body with filters, metrics, fields (defaults to all), and page, then POSTs to /analytics/posts.
    async ({ profile_ids, metrics, created_time_start, created_time_end, fields, page }) => {
      const body: Record<string, unknown> = {
        filters: [
          `customer_profile_id.eq(${profile_ids.join(", ")})`,
          `created_time.in(${created_time_start}..${created_time_end})`,
        ],
        metrics,
      };
    
      if (fields && fields.length > 0) {
        body.fields = fields;
      } else {
        body.fields = ["created_time", "perma_link", "text", "post_type"];
      }
    
      if (page) body.page = page;
    
      const data = await sproutRequest("POST", "/analytics/posts", body);
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses important behaviors: supports pagination and the correct placement of the page parameter. This is valuable for correct invocation. No side effects or auth requirements are mentioned, but as a read operation, the disclosed behaviors are sufficient.

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?

Two sentences, minimal waste. The first sentence states purpose concisely; the second covers crucial pagination and parameter placement. Every part earns its place.

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

Completeness3/5

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

No output schema is provided, so the description should compensate. It mentions pagination but does not describe the response structure (e.g., what fields are returned in each page). For a tool with 6 parameters and moderate complexity, the description is adequate but leaves room for ambiguity about the response format.

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?

Schema coverage is 100%, so baseline is 3. The description adds value by listing valid metric options and explicitly stating which metrics are invalid (e.g., 'lifetime.comments'), preventing errors. It also notes that fields default to all if omitted. This enriches the schema's descriptions.

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

Purpose4/5

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

The description clearly states it retrieves post-level analytics (impressions, engagements) for a date range, using a specific verb and resource. However, it does not explicitly differentiate from sibling tools like get_profile_analytics or get_listening_topic_metrics, which are related but cover different scopes.

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 provides explicit guidance on pagination: instructing to check paging.total_pages and pull all pages. It also warns that the page parameter must be in the request body, not URL. This helps avoid common errors. However, it does not specify when to use this tool versus alternatives.

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/jginorio/sprout-social-mcp'

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