get_subreddit_info
Retrieve details about any Reddit community, including description, subscriber count, and rules, to understand its purpose and content.
Instructions
Get information about a subreddit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subreddit_name | Yes | Name of the subreddit (e.g. 'Python', 'news') |
Implementation Reference
- src/mcp_server_reddit/server.py:116-123 (handler)The handler function in the RedditServer class that fetches and returns subreddit information using the redditwarp client.def get_subreddit_info(self, subreddit_name: str) -> SubredditInfo: """Get information about a subreddit""" subr = self.client.p.subreddit.fetch_by_name(subreddit_name) return SubredditInfo( name=subr.name, subscriber_count=subr.subscriber_count, description=subr.public_description )
- Pydantic model defining the structure of the subreddit information output.class SubredditInfo(BaseModel): name: str subscriber_count: int description: str | None
- src/mcp_server_reddit/server.py:218-231 (registration)Tool registration in list_tools(), defining the tool name, description, and input schema.Tool( name=RedditTools.GET_SUBREDDIT_INFO.value, description="Get information about a subreddit", inputSchema={ "type": "object", "properties": { "subreddit_name": { "type": "string", "description": "Name of the subreddit (e.g. 'Python', 'news')", } }, "required": ["subreddit_name"] } ),
- src/mcp_server_reddit/server.py:384-388 (registration)Dispatch logic in call_tool() that handles arguments and invokes the handler.case RedditTools.GET_SUBREDDIT_INFO.value: subreddit_name = arguments.get("subreddit_name") if not subreddit_name: raise ValueError("Missing required argument: subreddit_name") result = reddit_server.get_subreddit_info(subreddit_name)