Skip to main content
Glama
jeebus87

reddirect

by jeebus87

Delete Post or Comment

delete_content

Delete your Reddit post or comment by submitting its full URL.

Instructions

Delete your own Reddit post or comment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesFull Reddit URL of your post or comment to delete

Implementation Reference

  • Registration of the 'delete_content' tool with the MCP server. Registers the tool name, title, description, and input schema for deleting a Reddit post or comment.
    server.registerTool(
      "delete_content",
      {
  • Input schema for 'delete_content': requires a 'url' string parameter (full Reddit URL of the post or comment to delete).
    inputSchema: z.object({
      url: z
        .string()
        .describe("Full Reddit URL of your post or comment to delete"),
    }),
  • Handler function that executes the delete logic. Extracts the thing ID from the URL using extractThingId, then calls client.post('/api/del', { id: thingId }) to delete the post or comment. Returns success/failure response.
      async ({ url }) => {
        try {
          const thingId = extractThingId(url);
          if (!thingId) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: "Could not extract post/comment ID from URL.",
                },
              ],
              isError: true,
            };
          }
    
          await client.post("/api/del", { id: thingId });
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  { success: true, id: thingId, deleted: true },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error deleting: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function extractThingId that parses a Reddit URL to extract the post/comment ID (t3_ for posts, t1_ for comments).
    function extractThingId(url: string): string | null {
      // Extract thing ID from URL like /r/sub/comments/abc123/title/
      const match = url.match(/\/comments\/([a-z0-9]+)/i);
      if (match) return `t3_${match[1]}`;
      // Or from a comment URL /r/sub/comments/postid/title/commentid/
      const commentMatch = url.match(
        /\/comments\/[a-z0-9]+\/[^/]*\/([a-z0-9]+)/i
      );
      if (commentMatch) return `t1_${commentMatch[1]}`;
      return null;
    }
  • RedditClient.post method used by the delete handler to make the POST request to /api/del endpoint.
    async post(
      endpoint: string,
      body: Record<string, string>
    ): Promise<any> {
      await this.ensureToken();
      if (!this.session?.username) {
        throw new Error(
          "Write operations require authentication. Run the 'authorize' tool first to connect your Reddit account (one-time browser authorization)."
        );
      }
      const url = endpoint.startsWith("http")
        ? endpoint
        : `${OAUTH_BASE}${endpoint}`;
      const res = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
          Authorization: `Bearer ${this.session!.accessToken}`,
          "User-Agent": this.userAgent,
        },
        body: new URLSearchParams({
          ...body,
          api_type: "json",
        }),
      });
      return res.json();
    }
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. It only states the action without mentioning side effects (destructive), authentication requirements, or whether it works on others' content. Minimal transparency.

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 one sentence with no wasted words. It is perfectly concise and front-loaded with the essential purpose.

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 simplicity of the tool (one parameter, no output schema), the description is minimally adequate. However, it lacks details on return values, error handling, or prerequisites, leaving some gaps.

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 coverage is 100% with a clear parameter description. The tool description adds no additional meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb (delete) and the resource (your own Reddit post or comment). It is specific enough to distinguish from sibling tools like edit_content or create_post.

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

Usage Guidelines3/5

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

The description implies when to use (when you want to delete your own content) but does not explicitly state when not to use or provide alternatives. No guidance on handling errors or restrictions.

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/jeebus87/reddirect'

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