Skip to main content
Glama

get_reddit_post_details

Retrieve comprehensive details about any Reddit post by providing its unique post ID to access information such as content, author, votes, and comments.

Instructions

Get detailed information about a specific Reddit post

Args: post_id: The Reddit post ID

Returns: Human readable string containing detailed post information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main tool handler function for 'get_reddit_post_details', decorated with @mcp.tool() which registers it in FastMCP. It handles input validation implicitly via type hints, fetches data using the RedditClient helper, formats the output as a human-readable string, provides initialization error messages, and error handling.
    @mcp.tool()
    async def get_reddit_post_details(post_id: str) -> str:
        """
        Get detailed information about a specific Reddit post
    
        Args:
            post_id: The Reddit post ID
    
        Returns:
            Human readable string containing detailed post information
        """
        if reddit_client is None:
            return """Error: Reddit client not initialized. 
    
    To fix this:
    1. Copy env.example to .env: cp env.example .env
    2. Edit .env with your Reddit API credentials:
       - Get credentials from https://old.reddit.com/prefs/apps/
       - Create a 'script' type app
       - Fill in REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, and REDDIT_USER_AGENT
    3. Restart the MCP server
    
    Example .env content:
    REDDIT_CLIENT_ID=your_14_char_client_id
    REDDIT_CLIENT_SECRET=your_27_char_client_secret  
    REDDIT_USER_AGENT=reddit-mcp-tool:v0.2.0 (by /u/yourusername)"""
        
        try:
            post_details = await reddit_client.get_post_details(post_id)
            
            result = (
                f"**{post_details['title']}**\n\n"
                f"Author: {post_details['author']}\n"
                f"Score: {post_details['score']} (upvote ratio: {post_details['upvote_ratio']:.0%})\n"
                f"Comments: {post_details['num_comments']}\n"
                f"Link: {post_details['permalink']}\n"
                f"Subreddit: r/{post_details['subreddit']}\n"
                f"Domain: {post_details['domain']}\n"
                f"Locked: {post_details['locked']}\n"
                f"Stickied: {post_details['stickied']}\n"
            )
            
            if post_details.get('flair_text'):
                result += f"Flair: {post_details['flair_text']}\n"
            
            if post_details['selftext']:
                result += f"\nContent:\n{post_details['selftext']}\n"
            
            return result
            
        except Exception as e:
            logger.error(f"Error getting post details for {post_id}: {str(e)}")
            return f"Error getting post details for {post_id}: {str(e)}"
  • The RedditClient.get_post_details method, a supporting utility that uses asyncpraw to fetch detailed post data from the Reddit API and returns a structured dictionary used by the tool handler.
    async def get_post_details(self, post_id: str) -> Dict[str, Any]:
        """Get detailed information about a specific post."""
        try:
            submission = await self.reddit.submission(id=post_id)
            
            return {
                "id": submission.id,
                "title": submission.title,
                "author": str(submission.author) if submission.author else "[deleted]",
                "score": submission.score,
                "upvote_ratio": submission.upvote_ratio,
                "url": submission.url,
                "permalink": f"https://reddit.com{submission.permalink}",
                "created_utc": submission.created_utc,
                "num_comments": submission.num_comments,
                "selftext": submission.selftext,
                "is_self": submission.is_self,
                "domain": submission.domain,
                "subreddit": str(submission.subreddit),
                "flair_text": submission.link_flair_text,
                "locked": submission.locked,
                "stickied": submission.stickied,
            }
            
        except Exception as e:
            raise Exception(f"Error getting post details for {post_id}: {str(e)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions that it returns 'human readable string containing detailed post information', which gives some behavioral context about the output format. However, it lacks details on error handling, rate limits, authentication needs, or what 'detailed information' includes beyond the schema.

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 front-loaded with the core purpose in the first sentence. The 'Args' and 'Returns' sections are structured but could be more integrated. There's minimal waste, though the 'human readable string' note might be redundant if the output schema exists.

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's low complexity (1 parameter) and the presence of an output schema, the description is somewhat complete but has gaps. It covers the basic purpose and parameter, but without annotations, it should ideally include more behavioral context like error cases or usage distinctions from siblings.

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

Parameters3/5

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

The schema description coverage is 0%, so the description must compensate. It adds that 'post_id' is 'The Reddit post ID', which provides basic semantics beyond the schema's title 'Post Id'. However, it doesn't explain format (e.g., alphanumeric string), examples, or constraints, leaving gaps in parameter understanding.

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 tool's purpose with a specific verb ('Get') and resource ('detailed information about a specific Reddit post'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_hot_reddit_posts' or 'search_reddit_posts', which prevents a perfect score.

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. With sibling tools like 'search_reddit_posts' and 'get_hot_reddit_posts' available, there's no indication that this tool is for retrieving details of a known post ID rather than searching or listing posts.

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

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