Skip to main content
Glama

reply_to_post

Post a reply to an existing Reddit post by providing the post ID and content, enabling direct engagement in discussions.

Instructions

Post a reply to an existing Reddit post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYesThe ID of the post to reply to
contentYesThe content of the reply
subredditNoThe subreddit name if known (for validation)

Implementation Reference

  • The main tool handler function for 'reply_to_post'. It extracts parameters, gets the Reddit client, calls client.replyToPost, formats the comment info, and returns a success response with details.
    export async function replyToPost(params: {
      post_id: string;
      content: string;
      subreddit?: string;
    }) {
      const { post_id, content, subreddit } = params;
      const client = getRedditClient();
    
      if (!client) {
        throw new McpError(
          ErrorCode.InternalError,
          "Reddit client not initialized"
        );
      }
    
      try {
        console.log(`[Tool] Replying to post ${post_id}`);
        const comment = await client.replyToPost(post_id, content);
        const formattedComment = formatCommentInfo(comment);
    
        return {
          content: [
            {
              type: "text",
              text: `
    # Reply Posted Successfully
    
    ## Comment Details
    - Author: u/${formattedComment.author}
    - Subreddit: r/${formattedComment.context.subreddit}
    - Thread: ${formattedComment.context.thread}
    - Link: ${formattedComment.link}
    
    Your reply has been successfully posted.
              `,
            },
          ],
        };
      } catch (error) {
        console.error(`[Error] Error replying to post: ${error}`);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to reply to post: ${error}`
        );
      }
    }
  • The input schema and metadata for the 'reply_to_post' tool as registered in the listTools response.
      name: "reply_to_post",
      description: "Post a reply to an existing Reddit post",
      inputSchema: {
        type: "object",
        properties: {
          post_id: {
            type: "string",
            description: "The ID of the post to reply to",
          },
          content: {
            type: "string",
            description: "The content of the reply",
          },
          subreddit: {
            type: "string",
            description: "The subreddit name if known (for validation)",
          },
        },
        required: ["post_id", "content"],
      },
    },
  • src/index.ts:464-471 (registration)
    The switch case in the CallToolRequest handler that dispatches 'reply_to_post' calls to the tools.replyToPost function.
    case "reply_to_post":
      return await tools.replyToPost(
        toolParams as {
          post_id: string;
          content: string;
          subreddit?: string;
        }
      );
  • The core RedditClient.replyToPost method that authenticates, checks post existence, makes the API POST to /api/comment, and constructs the RedditComment response object.
    async replyToPost(postId: string, content: string): Promise<RedditComment> {
      await this.authenticate();
    
      if (!this.username || !this.password) {
        throw new Error("User authentication required for posting replies");
      }
    
      try {
        if (!(await this.checkPostExists(postId))) {
          throw new Error(
            `Post with ID ${postId} does not exist or is not accessible`
          );
        }
    
        const params = new URLSearchParams();
        params.append("thing_id", `t3_${postId}`);
        params.append("text", content);
    
        const response = await this.api.post("/api/comment", params, {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded",
          },
        });
    
        // Extract comment data from response
        const commentData = response.data;
        return {
          id: commentData.id,
          author: this.username,
          body: content,
          score: 1,
          controversiality: 0,
          subreddit: commentData.subreddit,
          submissionTitle: commentData.link_title,
          createdUtc: Date.now() / 1000,
          edited: false,
          isSubmitter: false,
          permalink: commentData.permalink,
        };
      } catch (error) {
        console.error(`[Error] Failed to reply to post ${postId}:`, error);
        throw new Error(`Failed to reply to post ${postId}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Post a reply' implies a write/mutation operation, the description doesn't address critical behavioral aspects: required authentication/permissions, rate limits, whether replies are editable/deletable, response format, or error conditions. This leaves significant gaps for a mutation tool.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately front-loaded with the core action and target, making it immediately scannable and understandable.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address authentication requirements, response format, error handling, or behavioral constraints that would help an agent use this tool effectively. The combination of mutation nature and lack of structured metadata demands more descriptive context than provided.

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?

With 100% schema description coverage, all three parameters are documented in the schema. The description adds no additional parameter context beyond what's already in the schema descriptions (e.g., format of post_id, content constraints, purpose of subreddit validation). This meets the baseline expectation when schema coverage is complete.

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 ('Post a reply') and target resource ('to an existing Reddit post'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools like 'create_post' or 'get_comment', which would require more specific language about reply functionality versus other post/comment operations.

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 like 'create_post' for new posts or 'get_comment' for reading comments. There's no mention of prerequisites (e.g., authentication needs), appropriate contexts, or exclusions, leaving the agent with minimal usage direction beyond the basic purpose statement.

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