Skip to main content
Glama

get_post_comments

Retrieve comments from Substack posts to analyze reader engagement and feedback. Returns commenter details, text, dates, and reactions.

Instructions

Get comments on a published post. Returns commenter name, comment body, date, and reaction counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYesThe post ID to get comments for
limitNoMax comments to return (default 20)

Implementation Reference

  • The handler function for get_post_comments tool. Calls the API client to fetch comments, then maps the response to extract id, name, body, date, reactions, and replies count, returning the result as formatted JSON.
    async ({ post_id, limit }) => {
      const comments = await client.getPostComments(post_id, limit);
      const summary = comments.map((c) => ({
        id: c.id,
        name: c.name,
        body: c.body,
        date: c.date,
        reactions: c.reactions,
        replies: c.children_count,
      }));
      return {
        content: [{ type: "text", text: JSON.stringify(summary, null, 2) }],
      };
    },
  • src/server.ts:142-163 (registration)
    Registration of the get_post_comments tool with MCP server. Defines the tool name, description, input schema (post_id as number, limit as optional number with default 20), and the handler function.
    server.tool(
      "get_post_comments",
      "Get comments on a published post. Returns commenter name, comment body, date, and reaction counts.",
      {
        post_id: z.number().describe("The post ID to get comments for"),
        limit: z.number().optional().default(20).describe("Max comments to return (default 20)"),
      },
      async ({ post_id, limit }) => {
        const comments = await client.getPostComments(post_id, limit);
        const summary = comments.map((c) => ({
          id: c.id,
          name: c.name,
          body: c.body,
          date: c.date,
          reactions: c.reactions,
          replies: c.children_count,
        }));
        return {
          content: [{ type: "text", text: JSON.stringify(summary, null, 2) }],
        };
      },
    );
  • API client method getPostComments that fetches comments from the Substack API endpoint /api/v1/post/{postId}/comments. Returns an array of SubstackComment objects, sliced to the specified limit.
    async getPostComments(
      postId: number,
      limit = 20,
    ): Promise<SubstackComment[]> {
      const data = await this.request<{ comments: SubstackComment[] }>(
        `${this.publicationUrl}/api/v1/post/${postId}/comments`,
      );
      const comments = data.comments || [];
      return comments.slice(0, limit);
    }
  • TypeScript interface SubstackComment defining the structure of comment objects returned by the API. Includes id, body, name, date, user_id, optional reactions map, and children_count for replies.
    export interface SubstackComment {
      id: number;
      body: string;
      body_json?: unknown;
      name: string;
      date: string;
      user_id: number;
      author_is_admin?: boolean;
      reactions?: Record<string, number>;
      children_count?: number;
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that it returns specific fields (commenter name, body, date, reaction counts), which adds useful context beyond the input schema. However, it lacks details on error handling, pagination (beyond the 'limit' parameter), or whether it requires authentication, leaving behavioral gaps.

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 two concise sentences with zero waste. The first sentence states the purpose, and the second specifies the return data, making it front-loaded and efficient. Every sentence earns its place by adding value.

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?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and return data but lacks details on error cases, authentication, or how it integrates with sibling tools. Without an output schema, it should ideally explain more about the return structure, but it does specify key fields, which helps.

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 description coverage is 100%, so the schema already fully documents both parameters ('post_id' and 'limit'). The description does not add any additional meaning or context about the parameters beyond what the schema provides, such as format constraints or usage examples, meeting the baseline for high coverage.

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 states the action ('Get comments') and the resource ('on a published post'), distinguishing it from siblings like 'get_post' (which retrieves the post itself) or 'list_published_posts' (which lists posts). It specifies the scope as comments on a specific post, not general comment listing.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention siblings like 'get_post' (which might include comments) or clarify if this is the primary method for retrieving comments versus other potential tools. Usage is implied but not explicitly stated.

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/conorbronsdon/substack-mcp'

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