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 }
      );
Behavior1/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. It only states the action without mentioning permissions, rate limits, error handling, or response format. This leaves critical behavioral traits unspecified for a read operation.

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

Conciseness5/5

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

The description is extremely concise with a single sentence, 'Get a Reddit post', which is front-loaded and wastes no words. However, this brevity contributes to underspecification rather than effective communication.

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 lack of annotations and output schema, the description is incomplete. It fails to explain what the tool returns (e.g., post details, comments, metadata) or any behavioral aspects, leaving significant gaps for a tool with two required parameters and multiple 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?

Schema description coverage is 100%, with clear descriptions for both parameters ('subreddit' and 'post_id'). The description adds no additional meaning beyond the schema, such as format examples or constraints, but the schema adequately documents the inputs, meeting the baseline for high coverage.

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

Purpose2/5

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

The description 'Get a Reddit post' restates the tool name with minimal elaboration, making it tautological. It specifies the action ('Get') and resource ('Reddit post') but lacks differentiation from sibling tools like 'get_submission' or 'get_user_posts', leaving ambiguity about scope or uniqueness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'get_submission' or 'get_user_posts'. The description offers no context, prerequisites, or exclusions, failing to help an agent choose appropriately among similar tools.

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/samy-clivolt/reddit-mcp-server'

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