Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

get_user_posts

Retrieve Reddit posts submitted by a specific user, with options to sort by hot, new, or top and control the number of results returned.

Instructions

Get posts submitted by a user

Input Schema

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

Implementation Reference

  • Core handler function in RedditClient that fetches user's submitted posts from the Reddit API endpoint `/user/{username}/submitted`, maps the response data to RedditPost objects using mapPost.
    async getUserPosts(username: string, sort: 'hot' | 'new' | 'top' = 'new', limit: number = 25): Promise<RedditPost[]> {
      const data = await this.makeRequest(`/user/${username}/submitted?sort=${sort}&limit=${limit}`);
      return data.data.children.map((child: any) => this.mapPost(child.data));
    }
  • Zod schema for runtime validation of input arguments to the get_user_posts tool.
    const GetUserPostsSchema = 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:178-204 (registration)
    Tool registration in the MCP listTools response, defining the tool's name, description, and JSON schema for inputs.
    {
      name: 'get_user_posts',
      description: 'Get posts submitted 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 posts',
            default: 'new',
          },
          limit: {
            type: 'number',
            description: 'Number of posts to retrieve (1-100)',
            minimum: 1,
            maximum: 100,
            default: 25,
          },
        },
        required: ['username'],
      },
    },
  • Dispatch handler in MCP callTool request that parses arguments with Zod schema and invokes the RedditClient.getUserPosts method, formats response as MCP content.
    case 'get_user_posts': {
      const args = GetUserPostsSchema.parse(request.params.arguments);
      const posts = await redditClient.getUserPosts(args.username, args.sort, args.limit);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(posts, 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 the full burden of behavioral disclosure. It states the action ('Get posts') but lacks details on permissions (e.g., if it works for private users), rate limits, error handling (e.g., invalid usernames), or output format (e.g., pagination, data structure). This is a significant gap for a tool with no annotation coverage.

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 ('Get posts submitted by a user') that directly conveys the core functionality without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

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 complexity (3 parameters, no annotations, no output schema), the description is incomplete. It lacks behavioral context (e.g., how posts are retrieved, error scenarios), usage guidelines relative to siblings, and details on output (e.g., what data is returned). While the schema covers parameters well, the overall context for effective tool selection and invocation is insufficient.

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?

The input schema has 100% description coverage, with clear documentation for 'username', 'sort' (including enum values and default), and 'limit' (with range and default). The description does not add any semantic details beyond what the schema provides, such as explaining the impact of 'sort' options or typical use cases for 'limit'. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Get posts submitted by a user' clearly states the verb ('Get') and resource ('posts submitted by a user'), making the purpose immediately understandable. However, it does not explicitly differentiate from sibling tools like 'get_user_comments' or 'get_subreddit_posts', which handle similar resources but with different scopes (e.g., comments vs. posts, user vs. subreddit).

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. For example, it does not mention when to choose 'get_user_posts' over 'search_posts' (which might filter by user) or 'get_subreddit_posts' (which focuses on subreddit content). There is also no indication of prerequisites, such as needing a valid username, though this is implied by the required parameter.

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