Skip to main content
Glama

get_post_comments

Retrieve comments from a Substack post, including commenter name, body, date, and reaction counts. Specify the post ID and optionally limit results.

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

  • Tool registration for 'get_post_comments' — defines the schema (post_id required, limit optional) and handler logic that calls client.getPostComments() and maps results to a summary with id, name, body, date, reactions, and replies.
    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) }],
        };
      },
    );
  • Input schema for get_post_comments: post_id (number, required) and limit (number, optional, default 20).
    {
      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)"),
    },
  • src/server.ts:142-163 (registration)
    Registration of the 'get_post_comments' tool on the McpServer via server.tool().
    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) }],
        };
      },
    );
  • Client method getPostComments() — makes HTTP GET request to /api/v1/post/{postId}/comments and returns up to `limit` comments as SubstackComment[] objects.
    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);
    }
  • SubstackComment interface — defines the shape of comment data: id, body, name, date, user_id, reactions, children_count.
    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;
    }
Behavior2/5

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

No annotations provided. Description only mentions it's a read operation and lists return fields. Does not disclose behaviors like pagination, sorting, authentication, or rate limits.

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 succinct sentences, front-loaded with purpose. No redundant words.

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?

Adequate for a simple read tool with well-described schema. But lacks usage guidelines and behavioral transparency, leaving gaps for an AI agent.

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 has 100% description coverage. Description adds context that the post must be published, which is not in the schema, and specifies return fields.

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 'Get', resource 'comments', and scope 'on a published post'. Returns specific fields, distinguishing from sibling tools like get_post.

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?

No explicit instructions on when to use or alternatives. Usage is implied for getting comments, but lacks guidance on when not to use or prerequisites.

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