Skip to main content
Glama
Hawstein

MCP Server Reddit

by Hawstein

get_subreddit_new_posts

Retrieve recent posts from any Reddit community by specifying the subreddit name and desired post count.

Instructions

Get new posts from a specific subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subreddit_nameYesName of the subreddit (e.g. 'Python', 'news')
limitNoNumber of posts to return (default: 10)

Implementation Reference

  • The handler function that fetches the newest posts from the specified subreddit using the redditwarp client. It iterates over new posts, builds Post model instances using the _build_post helper, and returns a list of Post objects.
    def get_subreddit_new_posts(self, subreddit_name: str, limit: int = 10) -> list[Post]:
        """Get new posts from a specific subreddit"""
        posts = []
        for subm in self.client.p.subreddit.pull.new(subreddit_name, limit):
            posts.append(self._build_post(subm))
        return posts
  • Pydantic model defining the structure of a Post returned by the tool, including fields like id, title, author, score, subreddit, url, timestamp, comment count, post type, and content.
    class Post(BaseModel):
        id: str
        title: str
        author: str
        score: int
        subreddit: str
        url: str
        created_at: str
        comment_count: int
        post_type: PostType
        content: str | None
  • JSON schema defining the tool's input parameters: subreddit_name (required string) and optional limit (integer 1-100, default 10). Used for MCP tool validation.
    inputSchema={
        "type": "object",
        "properties": {
            "subreddit_name": {
                "type": "string",
                "description": "Name of the subreddit (e.g. 'Python', 'news')",
            },
            "limit": {
                "type": "integer",
                "description": "Number of posts to return (default: 10)",
                "default": 10,
                "minimum": 1,
                "maximum": 100
            }
        },
        "required": ["subreddit_name"]
  • Registers the tool with MCP server via list_tools(), specifying name, description, and input schema.
    Tool(
        name=RedditTools.GET_SUBREDDIT_NEW_POSTS.value,
        description="Get new posts from a specific subreddit",
        inputSchema={
            "type": "object",
            "properties": {
                "subreddit_name": {
                    "type": "string",
                    "description": "Name of the subreddit (e.g. 'Python', 'news')",
                },
                "limit": {
                    "type": "integer",
                    "description": "Number of posts to return (default: 10)",
                    "default": 10,
                    "minimum": 1,
                    "maximum": 100
                }
            },
            "required": ["subreddit_name"]
        }
    ),
  • Dispatches tool calls in the call_tool handler by matching the tool name and invoking the corresponding RedditServer method with parsed arguments.
    case RedditTools.GET_SUBREDDIT_NEW_POSTS.value:
        subreddit_name = arguments.get("subreddit_name")
        if not subreddit_name:
            raise ValueError("Missing required argument: subreddit_name")
        limit = arguments.get("limit", 10)
        result = reddit_server.get_subreddit_new_posts(subreddit_name, limit)
  • Helper function used by the handler to construct Post models from raw redditwarp submission objects, calling other helpers for post_type and content.
    def _build_post(self, submission) -> Post:
        """Helper method to build Post object from submission"""
        return Post(
            id=submission.id36,
            title=submission.title,
            author=submission.author_display_name or '[deleted]',
            score=submission.score,
            subreddit=submission.subreddit.name,
            url=submission.permalink,
            created_at=submission.created_at.astimezone().isoformat(),
            comment_count=submission.comment_count,
            post_type=self._get_post_type(submission),
            content=self._get_post_content(submission)
        )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves posts but omits critical details such as rate limits, authentication requirements, pagination behavior, error handling, or the format of returned data. This leaves significant gaps for an agent to understand how the tool behaves in practice.

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 unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly while conveying the core purpose.

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 lack of annotations and output schema, the description is incomplete for a tool that likely involves API calls with behavioral nuances. It fails to address key contextual aspects like data format, error conditions, or operational constraints, leaving the agent with insufficient information for reliable 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?

The input schema has 100% description coverage, clearly documenting both parameters ('subreddit_name' and 'limit') with examples and constraints. The description adds no additional semantic context beyond what the schema provides, so it meets the baseline for adequate but unenhanced parameter information.

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') and resource ('new posts from a specific subreddit'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from siblings like 'get_subreddit_hot_posts' or 'get_subreddit_top_posts' beyond the 'new' qualifier, which is implied but not contrasted.

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 like 'get_frontpage_posts' or other subreddit-specific tools (e.g., 'get_subreddit_hot_posts'). It lacks context about what 'new' means (e.g., chronological order, time frame) or any prerequisites, leaving usage entirely implicit.

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/Hawstein/mcp-server-reddit'

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