Skip to main content
Glama
jeebus87

reddirect

by jeebus87

Unsave Post or Comment

unsave_item

Remove a saved Reddit post or comment from your collection by providing its full Reddit URL.

Instructions

Remove a Reddit post or comment from your saved items list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesFull Reddit URL of the post or comment to unsave

Implementation Reference

  • The handler function for the unsave_item tool. Extracts a thing ID from a Reddit URL, then calls the Reddit API /api/unsave endpoint to unsave the item. Returns success/failure response.
    async ({ url }) => {
      try {
        const thingId = extractThingId(url);
        if (!thingId) {
          return {
            content: [{ type: "text" as const, text: "Could not extract ID from URL." }],
            isError: true,
          };
        }
        await client.post("/api/unsave", { id: thingId });
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({ success: true, id: thingId, unsaved: true }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            { type: "text" as const, text: `Error unsaving: ${error instanceof Error ? error.message : String(error)}` },
          ],
          isError: true,
        };
      }
    }
  • Input validation schema for unsave_item. Accepts a single 'url' string parameter (the full Reddit URL of the post or comment to unsave).
    {
      title: "Unsave Post or Comment",
      description: "Remove a Reddit post or comment from your saved items list.",
      inputSchema: z.object({
        url: z.string().describe("Full Reddit URL of the post or comment to unsave"),
      }),
  • Registration of the unsave_item tool via server.registerTool(). This is how the tool is registered with the MCP server under the name 'unsave_item'.
    server.registerTool(
      "unsave_item",
      {
        title: "Unsave Post or Comment",
        description: "Remove a Reddit post or comment from your saved items list.",
        inputSchema: z.object({
          url: z.string().describe("Full Reddit URL of the post or comment to unsave"),
        }),
      },
      async ({ url }) => {
        try {
          const thingId = extractThingId(url);
          if (!thingId) {
            return {
              content: [{ type: "text" as const, text: "Could not extract ID from URL." }],
              isError: true,
            };
          }
          await client.post("/api/unsave", { id: thingId });
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ success: true, id: thingId, unsaved: true }, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              { type: "text" as const, text: `Error unsaving: ${error instanceof Error ? error.message : String(error)}` },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function extractThingId() that parses a Reddit URL to extract the thing ID (t1_ for comments, t3_ for posts), used by the unsave_item handler.
    function extractThingId(url: string): string | null {
      const commentMatch = url.match(
        /\/comments\/[a-z0-9]+\/[^/]*\/([a-z0-9]+)/i
      );
      if (commentMatch) return `t1_${commentMatch[1]}`;
      const postMatch = url.match(/\/comments\/([a-z0-9]+)/i);
      if (postMatch) return `t3_${postMatch[1]}`;
      return null;
    }
  • src/index.ts:31-33 (registration)
    Registration call in the main entry point, where registerSaveTools (from src/tools/save.ts) is called to register all save-related tools including unsave_item.
    registerSaveTools(server, client);
    registerInboxTools(server, client);
    registerSubscriptionTools(server, client);
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states the basic action without mentioning side effects, authentication requirements, error handling, or idempotency. This is a significant gap for a write operation.

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 a single concise sentence with no filler. It is appropriately sized for a simple tool, though a slightly more structured format could improve scannability.

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 has one parameter, no output schema, and no annotations, the description is adequate but lacks completeness. It does not mention return behavior or error scenarios, but it covers the core function. For a simple tool, this is minimally viable.

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 input schema has 100% coverage with a clear description for the 'url' parameter. The tool description adds no extra meaning beyond what is already in the schema, so it meets the baseline but does not enhance parameter understanding.

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 specifies the verb 'Remove' and the resource 'saved items list' for both posts and comments. It distinguishes from siblings like 'save_item' (opposite action) and 'delete_content' (removes content itself), making the purpose unambiguous.

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 the tool is for unsaving previously saved items but does not explicitly state when to use it versus alternatives like 'delete_content' or 'save_item'. No guidance on prerequisites or conditions such as needing to have the item saved first.

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