Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

get_subreddit_posts

Retrieve posts from any subreddit using sort options like hot, new, top, or rising to access Reddit content programmatically.

Instructions

Get posts from a specific subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subredditYesName of the subreddit (without r/ prefix)
sortNoSort order for postshot
limitNoNumber of posts to retrieve (1-100)

Implementation Reference

  • MCP tool handler for 'get_subreddit_posts' that validates arguments with Zod schema and delegates to RedditClient.getSubredditPosts, returning JSON-formatted posts.
    case 'get_subreddit_posts': {
      const args = GetSubredditPostsSchema.parse(request.params.arguments);
      const posts = await redditClient.getSubredditPosts(args.subreddit, args.sort, args.limit);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(posts, null, 2),
          },
        ],
      };
    }
  • Zod schema defining input parameters for the get_subreddit_posts tool: subreddit (required), sort (enum with default), limit (1-100 with default).
    const GetSubredditPostsSchema = z.object({
      subreddit: z.string().min(1, "Subreddit name is required"),
      sort: z.enum(['hot', 'new', 'top', 'rising']).default('hot'),
      limit: z.number().min(1).max(100).default(25),
    });
  • src/index.ts:90-115 (registration)
    Tool registration metadata including name, description, and JSON schema for inputs, provided in response to ListToolsRequest.
      name: 'get_subreddit_posts',
      description: 'Get posts from a specific subreddit',
      inputSchema: {
        type: 'object',
        properties: {
          subreddit: {
            type: 'string',
            description: 'Name of the subreddit (without r/ prefix)',
          },
          sort: {
            type: 'string',
            enum: ['hot', 'new', 'top', 'rising'],
            description: 'Sort order for posts',
            default: 'hot',
          },
          limit: {
            type: 'number',
            description: 'Number of posts to retrieve (1-100)',
            minimum: 1,
            maximum: 100,
            default: 25,
          },
        },
        required: ['subreddit'],
      },
    },
  • Core helper method in RedditClient that makes authenticated API request to fetch subreddit posts and maps Reddit API response to RedditPost objects.
    async getSubredditPosts(subreddit: string, sort: 'hot' | 'new' | 'top' | 'rising' = 'hot', limit: number = 25): Promise<RedditPost[]> {
      const data = await this.makeRequest(`/r/${subreddit}/${sort}?limit=${limit}`);
      return data.data.children.map((child: any) => this.mapPost(child.data));
    }
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 for behavioral disclosure. It states the basic action but lacks critical details: it doesn't mention whether this is a read-only operation (implied but not explicit), what authentication might be required, rate limits, pagination behavior, or what format/fields the returned posts include. For a tool with no annotation coverage, this is insufficient.

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 that directly states the tool's function without any wasted words. It's appropriately sized for a straightforward retrieval tool and front-loads the core purpose effectively.

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 has no annotations and no output schema, the description is incomplete. It doesn't explain what the return values look like (e.g., post objects with titles, scores, etc.), error conditions, or behavioral constraints. For a data retrieval tool with multiple parameters, more context is needed to guide effective use.

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%, with all parameters well-documented in the schema itself (subreddit name format, sort options with default, limit range with default). The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline for high schema coverage without compensating value.

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 action ('Get posts') and resource ('from a specific subreddit'), making the purpose immediately understandable. However, it doesn't distinguish this tool from similar siblings like 'get_user_posts' or 'search_posts', which would require specifying that this retrieves posts specifically from a subreddit feed rather than user content or search results.

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. With siblings like 'search_posts' and 'get_user_posts' available, there's no indication of when this subreddit-focused retrieval is preferred over those other methods, leaving usage context ambiguous.

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