Skip to main content
Glama
jginorio

Sprout Social MCP Server

by jginorio

get_messages

Retrieve messages from your Sprout Social inbox, including both received and sent messages. Supports cursor-based pagination for efficient browsing.

Instructions

Retrieve messages from your Sprout Social inbox. Supports cursor-based pagination. Messages include those received by and sent from your profiles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profile_idsYesArray of customer_profile_id values to filter messages by.
created_time_startNoFilter messages created after this ISO 8601 datetime.
created_time_endNoFilter messages created before this ISO 8601 datetime.
fieldsNoFields to return. Refer to Sprout API docs for valid message fields.
sortNoSort order, e.g. ['created_time:desc'].
limitNoMaximum number of messages to return per page.

Implementation Reference

  • src/index.ts:276-326 (registration)
    Registers the 'get_messages' tool on the McpServer with Zod schema for parameters (profile_ids, created_time_start, created_time_end, fields, sort, limit) and a handler that sends a POST request to the Sprout Social /messages API endpoint.
    server.tool(
      "get_messages",
      "Retrieve messages from your Sprout Social inbox. Supports cursor-based pagination. " +
        "Messages include those received by and sent from your profiles.",
      {
        profile_ids: z
          .array(z.string())
          .describe("Array of customer_profile_id values to filter messages by."),
        created_time_start: z
          .string()
          .optional()
          .describe("Filter messages created after this ISO 8601 datetime."),
        created_time_end: z
          .string()
          .optional()
          .describe("Filter messages created before this ISO 8601 datetime."),
        fields: z
          .array(z.string())
          .optional()
          .describe(
            "Fields to return. Refer to Sprout API docs for valid message fields."
          ),
        sort: z
          .array(z.string())
          .optional()
          .describe("Sort order, e.g. ['created_time:desc']."),
        limit: z
          .number()
          .optional()
          .describe("Maximum number of messages to return per page."),
      },
      async ({ profile_ids, created_time_start, created_time_end, fields, sort, limit }) => {
        const filters: string[] = [
          `customer_profile_id.eq(${profile_ids.join(", ")})`,
        ];
    
        if (created_time_start && created_time_end) {
          filters.push(
            `created_time.in(${created_time_start}..${created_time_end})`
          );
        }
    
        const body: Record<string, unknown> = { filters };
        if (fields) body.fields = fields;
        if (sort) body.sort = sort;
        if (limit) body.limit = limit;
    
        const data = await sproutRequest("POST", "/messages", body);
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The async handler function for the 'get_messages' tool. It builds a filter array with customer_profile_id.eq and optionally created_time.in, constructs the request body with optional fields/sort/limit, calls sproutRequest('POST', '/messages', body), and returns the result as text content.
    async ({ profile_ids, created_time_start, created_time_end, fields, sort, limit }) => {
      const filters: string[] = [
        `customer_profile_id.eq(${profile_ids.join(", ")})`,
      ];
    
      if (created_time_start && created_time_end) {
        filters.push(
          `created_time.in(${created_time_start}..${created_time_end})`
        );
      }
    
      const body: Record<string, unknown> = { filters };
      if (fields) body.fields = fields;
      if (sort) body.sort = sort;
      if (limit) body.limit = limit;
    
      const data = await sproutRequest("POST", "/messages", body);
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
  • Zod schema definitions for the 'get_messages' tool parameters: profile_ids (required array of strings), created_time_start/created_time_end (optional ISO 8601 strings), fields (optional array of strings), sort (optional array of strings), limit (optional number).
    {
      profile_ids: z
        .array(z.string())
        .describe("Array of customer_profile_id values to filter messages by."),
      created_time_start: z
        .string()
        .optional()
        .describe("Filter messages created after this ISO 8601 datetime."),
      created_time_end: z
        .string()
        .optional()
        .describe("Filter messages created before this ISO 8601 datetime."),
      fields: z
        .array(z.string())
        .optional()
        .describe(
          "Fields to return. Refer to Sprout API docs for valid message fields."
        ),
      sort: z
        .array(z.string())
        .optional()
        .describe("Sort order, e.g. ['created_time:desc']."),
      limit: z
        .number()
        .optional()
        .describe("Maximum number of messages to return per page."),
    },
Behavior3/5

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

With no annotations, the description carries full burden. It notes cursor-based pagination but lacks details on side effects, authentication, rate limits, or data freshness.

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, front-loaded with purpose, then pagination, then content scope. Efficient and no fluff.

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, so description should explain return shape. Mentions messages include sent/received but lacks field structure or pagination behavior details.

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

Parameters3/5

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

Schema coverage is 100%, so baseline 3. Description adds no parameter-specific details beyond schema, e.g., how pagination interacts with 'limit'.

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?

Description clearly states verb ('retrieve'), resource ('messages'), and scope ('Sprout Social inbox', 'both received and sent'). Distinguishes from siblings like get_listening_topic_messages and get_cases.

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

Usage Guidelines3/5

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

Mentions cursor-based pagination but does not specify when to use this tool versus alternatives, nor are there any explicit conditions or exclusions.

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