Skip to main content
Glama

get_reddit_post

Fetch a specific Reddit post by providing its subreddit and post ID for content retrieval and analysis.

Instructions

Get a Reddit post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subredditYesThe subreddit to fetch posts from
post_idYesThe ID of the post to fetch

Implementation Reference

  • The primary handler function for the 'get_reddit_post' tool. It fetches the specified Reddit post using the Reddit client, formats the information, and returns a detailed markdown-formatted response including post details, content, stats, metadata, links, and engagement analysis.
    export async function getRedditPost(params: {
      subreddit: string;
      post_id: string;
    }) {
      const { subreddit, post_id } = params;
      const client = getRedditClient();
    
      if (!client) {
        throw new McpError(
          ErrorCode.InternalError,
          "Reddit client not initialized"
        );
      }
    
      try {
        console.log(`[Tool] Getting post ${post_id} from r/${subreddit}`);
        const post = await client.getPost(post_id, subreddit);
        const formattedPost = formatPostInfo(post);
    
        return {
          content: [
            {
              type: "text",
              text: `
    # Post from r/${formattedPost.subreddit}
    
    ## Post Details
    - Title: ${formattedPost.title}
    - Type: ${formattedPost.type}
    - Author: u/${formattedPost.author}
    
    ## Content
    ${formattedPost.content}
    
    ## Stats
    - Score: ${formattedPost.stats.score.toLocaleString()}
    - Upvote Ratio: ${(formattedPost.stats.upvoteRatio * 100).toFixed(1)}%
    - Comments: ${formattedPost.stats.comments.toLocaleString()}
    
    ## Metadata
    - Posted: ${formattedPost.metadata.posted}
    - Flags: ${
                formattedPost.metadata.flags.length
                  ? formattedPost.metadata.flags.join(", ")
                  : "None"
              }
    - Flair: ${formattedPost.metadata.flair}
    
    ## Links
    - Full Post: ${formattedPost.links.fullPost}
    - Short Link: ${formattedPost.links.shortLink}
    
    ## Engagement Analysis
    - ${formattedPost.engagementAnalysis.replace(/\n  - /g, "\n- ")}
    
    ## Best Time to Engage
    ${formattedPost.bestTimeToEngage}
              `,
            },
          ],
        };
      } catch (error) {
        console.error(`[Error] Error getting post: ${error}`);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to fetch post data: ${error}`
        );
      }
    }
  • Defines the input schema for the 'get_reddit_post' tool in the listTools response, requiring 'subreddit' and 'post_id' as strings.
    {
      name: "get_reddit_post",
      description: "Get a Reddit post",
      inputSchema: {
        type: "object",
        properties: {
          subreddit: {
            type: "string",
            description: "The subreddit to fetch posts from",
          },
          post_id: {
            type: "string",
            description: "The ID of the post to fetch",
          },
        },
        required: ["subreddit", "post_id"],
      },
    },
  • src/index.ts:429-432 (registration)
    Registers and dispatches the 'get_reddit_post' tool call to the imported tools.getRedditPost function in the CallToolRequest handler.
    case "get_reddit_post":
      return await tools.getRedditPost(
        toolParams as { subreddit: string; post_id: string }
      );

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.6/5.0
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 of behavioral disclosure. 'Get a Reddit post' implies a read-only operation, but it doesn't specify authentication requirements, rate limits, error handling, or what data is returned (e.g., title, body, upvotes). For a tool with zero annotation coverage, this leaves critical behavioral aspects undocumented.

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 extremely concise ('Get a Reddit post')—a single sentence with no wasted words. It's front-loaded with the core action. However, this brevity comes at the cost of completeness, as it omits necessary context for effective tool selection and use.

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

Completeness2/5

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

Given the tool's moderate complexity (2 required parameters, no output schema, and no annotations), the description is incomplete. It doesn't address return values, error cases, or how it differs from siblings. While the schema covers parameters, the lack of behavioral and contextual information makes this inadequate for a tool in a server with many similar alternatives.

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?

Schema description coverage is 100%, with clear descriptions for both parameters ('post_id' and 'subreddit'). The description adds no additional meaning beyond what the schema provides—it doesn't explain parameter relationships (e.g., that 'post_id' might be relative to 'subreddit') or usage nuances. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get a Reddit post' clearly states the verb ('Get') and resource ('Reddit post'), making the basic purpose understandable. However, it doesn't differentiate this tool from similar siblings like 'get_post_comments' or 'get_top_posts', which also retrieve Reddit content. The description is functional but lacks specificity about what exactly is retrieved (e.g., post metadata, content, or both).

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 siblings like 'get_post_comments' (for comments), 'get_top_posts' (for popular posts), and 'search_reddit' (for broader searches), there's no indication that this tool is specifically for fetching a single post by ID. The agent must infer usage from the parameter names alone, which is insufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.