Skip to main content
Glama
Hawstein

MCP Server Reddit

by Hawstein

get_subreddit_info

Retrieve detailed information about a specific subreddit, such as description, rules, and activity metrics, using the public Reddit API through the MCP Server Reddit.

Instructions

Get information about a subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subreddit_nameYesName of the subreddit (e.g. 'Python', 'news')

Implementation Reference

  • The handler function that implements the core logic of fetching subreddit information using redditwarp Client and constructing a SubredditInfo object.
    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 BaseModel defining the output structure for the get_subreddit_info tool.
    class SubredditInfo(BaseModel): name: str subscriber_count: int description: str | None
  • Tool registration in the list_tools() function, 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"] } ),
  • Dispatch logic in the call_tool() function that extracts 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)
  • Enum value defining the tool name constant.
    GET_SUBREDDIT_INFO = "get_subreddit_info"

Other Tools

Related 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