Skip to main content
Glama
jginorio

Sprout Social MCP Server

by jginorio

get_listening_topic_messages

Retrieve messages from a specific listening topic using its ID. Filter, sort, and paginate results to find relevant social media conversations.

Instructions

Get messages found within a specific listening topic. Use get_topics first to discover available topic IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topic_idYesThe listening topic ID.
filtersNoFilter expressions for the messages query.
fieldsNoFields to return for each message.
sortNoSort order for results.
limitNoMaximum messages per page.
pageNoPage number.

Implementation Reference

  • The async handler function that executes the tool logic. It builds a request body from optional parameters (filters, fields, sort, limit, page) and calls sproutRequest to POST to /listening/topics/{topic_id}/messages.
    async ({ topic_id, filters, fields, sort, limit, page }) => {
      const body: Record<string, unknown> = {};
      if (filters) body.filters = filters;
      if (fields) body.fields = fields;
      if (sort) body.sort = sort;
      if (limit) body.limit = limit;
      if (page) body.page = page;
    
      const data = await sproutRequest(
        "POST",
        `/listening/topics/${topic_id}/messages`,
        body
      );
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
  • Zod schema defining the input parameters for the tool: topic_id (required string), filters (optional array of strings), fields (optional array of strings), sort (optional array of strings), limit (optional number), page (optional number).
    {
      topic_id: z.string().describe("The listening topic ID."),
      filters: z
        .array(z.string())
        .optional()
        .describe("Filter expressions for the messages query."),
      fields: z
        .array(z.string())
        .optional()
        .describe("Fields to return for each message."),
      sort: z
        .array(z.string())
        .optional()
        .describe("Sort order for results."),
      limit: z.number().optional().describe("Maximum messages per page."),
      page: z.number().optional().describe("Page number."),
    },
  • src/index.ts:364-400 (registration)
    Registration of the tool on the McpServer instance via server.tool() with the name 'get_listening_topic_messages' and a description.
    server.tool(
      "get_listening_topic_messages",
      "Get messages found within a specific listening topic. " +
        "Use get_topics first to discover available topic IDs.",
      {
        topic_id: z.string().describe("The listening topic ID."),
        filters: z
          .array(z.string())
          .optional()
          .describe("Filter expressions for the messages query."),
        fields: z
          .array(z.string())
          .optional()
          .describe("Fields to return for each message."),
        sort: z
          .array(z.string())
          .optional()
          .describe("Sort order for results."),
        limit: z.number().optional().describe("Maximum messages per page."),
        page: z.number().optional().describe("Page number."),
      },
      async ({ topic_id, filters, fields, sort, limit, page }) => {
        const body: Record<string, unknown> = {};
        if (filters) body.filters = filters;
        if (fields) body.fields = fields;
        if (sort) body.sort = sort;
        if (limit) body.limit = limit;
        if (page) body.page = page;
    
        const data = await sproutRequest(
          "POST",
          `/listening/topics/${topic_id}/messages`,
          body
        );
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states the basic operation without disclosing behavioral traits such as rate limits, authentication, error handling, or whether the operation is read-only. The description is too sparse to inform safe usage.

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 concise sentences with no filler. The key point (get messages for a topic) is front-loaded, and the prerequisite step is mentioned briefly.

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

Completeness2/5

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

With 6 parameters including pagination (limit, page), filtering, and field selection, but no output schema, the description should explain behavior like pagination, filtering syntax, or default fields. It omits these, leaving agents to guess.

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 the input schema already documents all parameters. The description adds no extra meaning beyond the schema. Baseline of 3 is appropriate.

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?

Clearly states it gets messages for a specific listening topic. Distinguishes from siblings like get_messages and get_listening_topic_metrics by mentioning topic scope and referencing get_topics for ID discovery.

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?

Explicitly advises to use get_topics first to obtain topic IDs, providing a necessary sequence hint. However, it does not contrast with alternatives like get_messages or specify when not 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/jginorio/sprout-social-mcp'

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