Skip to main content
Glama
Hawstein

MCP Server Reddit

by Hawstein

get_subreddit_new_posts

Retrieve recent posts from a specified subreddit using the Reddit API. Specify the subreddit name and limit the number of posts to fetch for up-to-date content monitoring.

Instructions

Get new posts from a specific subreddit

Input Schema

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

Implementation Reference

  • The handler function that implements the logic to fetch new posts from a subreddit using the redditwarp client.
    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
  • The input schema and description for the tool, used in MCP tool registration.
    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"] } ),
  • The dispatch case in the call_tool handler that routes arguments to the tool handler.
    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)
  • Enum value defining the standardized name for the tool.
    GET_SUBREDDIT_NEW_POSTS = "get_subreddit_new_posts"

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