Skip to main content
Glama
adhikasp
by adhikasp

fetch_reddit_hot_threads

Retrieve trending posts from any subreddit to monitor popular discussions and content.

Instructions

Fetch hot threads from a subreddit

Args: subreddit: Name of the subreddit limit: Number of posts to fetch (default: 10)

Returns: Human readable string containing list of post information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subredditYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'fetch_reddit_hot_threads' tool. It fetches hot posts from a specified subreddit using the redditwarp client, formats post information including title, score, comments, author, type, content, and link, and returns a formatted string. Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def fetch_reddit_hot_threads(subreddit: str, limit: int = 10) -> str:
        """
        Fetch hot threads from a subreddit
    
        Args:
            subreddit: Name of the subreddit
            limit: Number of posts to fetch (default: 10)
    
        Returns:
            Human readable string containing list of post information
        """
        try:
            posts = []
            async for submission in client.p.subreddit.pull.hot(subreddit, limit):
                post_info = (
                    f"Title: {submission.title}\n"
                    f"Score: {submission.score}\n"
                    f"Comments: {submission.comment_count}\n"
                    f"Author: {submission.author_display_name or '[deleted]'}\n"
                    f"Type: {_get_post_type(submission)}\n"
                    f"Content: {_get_content(submission)}\n"
                    f"Link: https://reddit.com{submission.permalink}\n"
                    f"---"
                )
                posts.append(post_info)
    
            return "\n\n".join(posts)
    
        except Exception as e:
            logging.error(f"An error occurred: {str(e)}")
            return f"An error occurred: {str(e)}"
  • Helper function to determine the type of a Reddit submission (link, text, gallery, or unknown). Used in post_info formatting.
    def _get_post_type(submission) -> str:
        """Helper method to determine post type"""
        if isinstance(submission, LinkPost):
            return 'link'
        elif isinstance(submission, TextPost):
            return 'text'
        elif isinstance(submission, GalleryPost):
            return 'gallery'
        return 'unknown'
  • Helper function to extract appropriate content or link from a Reddit submission based on its type. Used in post_info formatting.
    def _get_content(submission) -> Optional[str]:
        """Helper method to extract post content based on type"""
        if isinstance(submission, LinkPost):
            return submission.permalink
        elif isinstance(submission, TextPost):
            return submission.body
        elif isinstance(submission, GalleryPost):
            return str(submission.gallery_link)
        return None
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. While it mentions the return format ('human readable string'), it doesn't address critical behavioral aspects like rate limits, authentication requirements, error conditions, or whether this is a read-only operation. The description is insufficient for a tool that interacts with an external API.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured with clear sections for Args and Returns. Each sentence serves a purpose, though the 'Returns' section could be slightly more informative about the content format beyond 'human readable string'.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (though not provided in the prompt), the description doesn't need to detail return values extensively. However, for an API interaction tool with no annotations and sibling tools, the description should provide more behavioral context about limitations, errors, and differentiation from alternatives to be truly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description provides essential semantic context for both parameters: 'subreddit' is explained as 'name of the subreddit' and 'limit' as 'number of posts to fetch' with a default value. This compensates well for the lack of schema descriptions, though it doesn't specify format constraints or validation rules.

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 ('fetch') and resource ('hot threads from a subreddit'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from its sibling 'fetch_reddit_post_content', which appears to fetch content of individual posts rather than lists of hot threads.

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, including its sibling 'fetch_reddit_post_content'. There's no mention of prerequisites, limitations, or contextual factors that would help an agent decide between this tool and other options.

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

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