Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

get_user_comments

Retrieve comments posted by a specific Reddit user, with options to sort by hot, new, or top and limit results from 1 to 100 comments.

Instructions

Get comments made by a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesReddit username (without u/ prefix)
sortNoSort order for commentsnew
limitNoNumber of comments to retrieve (1-100)

Implementation Reference

  • MCP CallToolRequest handler implementation for the 'get_user_comments' tool. Parses arguments using Zod schema, calls RedditClient.getUserComments, and formats response as JSON text.
    case 'get_user_comments': {
      const args = GetUserCommentsSchema.parse(request.params.arguments);
      const comments = await redditClient.getUserComments(args.username, args.sort, args.limit);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(comments, null, 2),
          },
        ],
      };
    }
  • Zod schema for validating input parameters of the get_user_comments tool: username (required string), sort (enum: hot/new/top, default 'new'), limit (1-100, default 25).
    const GetUserCommentsSchema = z.object({
      username: z.string().min(1, "Username is required"),
      sort: z.enum(['hot', 'new', 'top']).default('new'),
      limit: z.number().min(1).max(100).default(25),
    });
  • src/index.ts:205-231 (registration)
    Tool registration in ListToolsResponse: defines name, description, and inputSchema matching the Zod schema.
    {
      name: 'get_user_comments',
      description: 'Get comments made by a user',
      inputSchema: {
        type: 'object',
        properties: {
          username: {
            type: 'string',
            description: 'Reddit username (without u/ prefix)',
          },
          sort: {
            type: 'string',
            enum: ['hot', 'new', 'top'],
            description: 'Sort order for comments',
            default: 'new',
          },
          limit: {
            type: 'number',
            description: 'Number of comments to retrieve (1-100)',
            minimum: 1,
            maximum: 100,
            default: 25,
          },
        },
        required: ['username'],
      },
    },
  • Core implementation in RedditClient: makes authenticated API request to Reddit's /user/{username}/comments endpoint and maps responses to RedditComment objects using mapComment helper.
    async getUserComments(username: string, sort: 'hot' | 'new' | 'top' = 'new', limit: number = 25): Promise<RedditComment[]> {
      const data = await this.makeRequest(`/user/${username}/comments?sort=${sort}&limit=${limit}`);
      return data.data.children.map((child: any) => this.mapComment(child.data));
    }
  • Helper method to transform raw Reddit API comment data into structured RedditComment interface.
    private mapComment(data: any): RedditComment {
      return {
        id: data.id,
        author: data.author,
        body: data.body,
        created_utc: data.created_utc,
        score: data.score,
        permalink: `https://reddit.com${data.permalink}`,
        parent_id: data.parent_id,
        subreddit: data.subreddit,
      };
    }
Behavior2/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 of behavioral disclosure. It states the action ('Get comments') but doesn't describe what the tool returns (e.g., comment text, metadata, pagination), rate limits, authentication needs, or error conditions. For a read operation with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence with zero waste. It's front-loaded with the core purpose ('Get comments made by a user'), making it immediately clear without unnecessary elaboration. Every word earns its place, and there's no redundancy or fluff.

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?

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the tool returns (e.g., comment data structure), potential errors (e.g., invalid username), or usage constraints. With no output schema and minimal behavioral context, an agent would struggle to use this effectively beyond basic invocation.

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 fully documents all three parameters (username, sort, limit) with descriptions, constraints, and defaults. The description adds no parameter-specific information beyond what the schema provides, such as clarifying the username format or explaining sort options. This meets the baseline for high schema coverage.

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 the verb ('Get') and resource ('comments made by a user'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'get_user_posts' (which retrieves posts) and 'get_post_comments' (which retrieves comments on a specific post). However, it doesn't specify the source platform (Reddit), which is only implied through the schema.

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 doesn't mention sibling tools like 'get_user_posts' (for posts instead of comments) or 'search_posts' (which might include comments in results), nor does it specify prerequisites or exclusions. Usage is implied by the name 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/liuyang1520/reddit-mcp'

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