Skip to main content
Glama

get_subreddit

Retrieve detailed information about a specific subreddit by providing its name. Use this tool to browse, search, and read subreddit content through the Reddit MCP server.

Instructions

Retrieve a subreddit by name. Args: subreddit_name: Name of the subreddit to retrieve Returns: Detailed information about the subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subreddit_nameYes

Implementation Reference

  • The main handler function that retrieves subreddit details using RedditClient and returns a structured SubredditResult.
    @validate_call(validate_return=True) def get_subreddit(subreddit_name: str) -> SubredditResult: """ Retrieve a subreddit by name. Args: subreddit_name: Name of the subreddit to retrieve Returns: Detailed information about the subreddit """ client = RedditClient.get_instance() subreddit = client.reddit.subreddit(subreddit_name) return SubredditResult( display_name=subreddit.display_name, title=subreddit.title, description=subreddit.description, public_description=subreddit.public_description, subscribers=subreddit.subscribers, created_utc=subreddit.created_utc, over18=subreddit.over18, url=subreddit.url, )
  • Pydantic BaseModel defining the output schema for the get_subreddit tool.
    class SubredditResult(BaseModel): """Subreddit details""" display_name: str = Field(description="Display name of the subreddit") title: str = Field(description="Title of the subreddit") description: str = Field(description="Full subreddit description") public_description: str = Field(description="Short public description") subscribers: int = Field(description="Number of subscribers") created_utc: float = Field(description="UTC timestamp when subreddit was created") over18: bool = Field(description="Whether the subreddit is NSFW") url: str = Field(description="URL of the subreddit")
  • The 'tools' list collects all tool functions, including get_subreddit, for registration in the MCP server.
    tools = [ get_submission, get_subreddit, get_comments_by_submission, get_comment_by_id, search_posts, search_subreddits, ]
  • Loop that registers each tool from the 'tools' list using FastMCP's tool decorator.
    for tool in tools: logger.info(f"Registering tool: {tool.__name__}") mcp.tool()(tool)

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

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