Skip to main content
Glama
jeebus87

reddirect

by jeebus87

Vote on Post or Comment

vote

Cast an upvote, downvote, or remove your vote on any Reddit post or comment. Specify the full URL and direction.

Instructions

Upvote, downvote, or remove your vote on a single Reddit post or comment. One vote per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesFull Reddit URL of the post or comment
directionYesVote direction: up, down, or unvote to remove

Implementation Reference

  • The register function that registers the 'vote' tool with server.registerTool, containing the full handler logic: extracts thing ID from URL, maps direction to dir parameter, and calls Reddit API /api/vote. Returns success/error response.
    export function register(server: McpServer, client: RedditClient): void {
      server.registerTool(
        "vote",
        {
          title: "Vote on Post or Comment",
          description:
            "Upvote, downvote, or remove your vote on a single Reddit post or comment. One vote per call.",
          inputSchema: z.object({
            url: z.string().describe("Full Reddit URL of the post or comment"),
            direction: z
              .enum(["up", "down", "unvote"])
              .describe("Vote direction: up, down, or unvote to remove"),
          }),
        },
        async ({ url, direction }) => {
          try {
            const thingId = extractThingId(url);
            if (!thingId) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Could not extract post/comment ID from URL.",
                  },
                ],
                isError: true,
              };
            }
    
            const dir =
              direction === "up" ? "1" : direction === "down" ? "-1" : "0";
            await client.post("/api/vote", { id: thingId, dir });
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(
                    { success: true, id: thingId, direction },
                    null,
                    2
                  ),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error voting: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        }
      );
    }
  • Input schema for the vote tool: url (string) and direction (enum: up, down, unvote).
    inputSchema: z.object({
      url: z.string().describe("Full Reddit URL of the post or comment"),
      direction: z
        .enum(["up", "down", "unvote"])
        .describe("Vote direction: up, down, or unvote to remove"),
    }),
  • src/index.ts:10-30 (registration)
    Import of the vote tool registration function in the main entry point.
    import { register as registerVoteTools } from "./tools/vote.js";
    import { register as registerSaveTools } from "./tools/save.js";
    import { register as registerInboxTools } from "./tools/inbox.js";
    import { register as registerSubscriptionTools } from "./tools/subscriptions.js";
    import { DEFAULT_SESSION_PATH } from "./constants.js";
    
    const server = new McpServer({
      name: "reddirect",
      version: "1.0.0",
    });
    
    const sessionPath =
      process.env.REDDIT_MCP_SESSION_PATH || DEFAULT_SESSION_PATH;
    
    const client = new RedditClient(sessionPath);
    
    registerAuthTools(server, client);
    registerBrowseTools(server, client);
    registerSearchTools(server, client);
    registerPostTools(server, client);
    registerVoteTools(server, client);
  • src/index.ts:30-30 (registration)
    Registration call for the vote tool in the main server setup.
    registerVoteTools(server, client);
  • ExtractThingId helper: parses a Reddit URL to extract the full thing ID (t1_ for comments, t3_ for posts).
    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;
    }
Behavior3/5

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

The description states that it modifies vote state and limits to one vote per call, but does not disclose whether votes are reversible (the 'unvote' option implies reversibility, but this is not explained). With no annotations, the description carries the full burden, but it fails to mention authentication requirements, rate limits, or what happens on success/failure.

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?

Two sentences, each adding value: the first states the resource and allowed actions, the second enforces the call limit. No wasted words. Front-loaded purpose.

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?

With no output schema and no annotations, the description should explain return values (e.g., success indicator, updated vote count) or error scenarios (e.g., invalid URL, vote not allowed). It does not. The tool is simple, but the description lacks completeness for an agent to fully understand consequences.

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%, so the input schema itself documents both parameters. The description adds no additional meaning beyond stating the three directions (up, down, unvote), which are already in the schema enum. Baseline 3 applies because schema does the heavy lifting.

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?

Clearly states it upvotes, downvotes, or removes a vote on a single Reddit post or comment. The verb 'vote' combined with the three actions makes the purpose specific and distinct from sibling tools like 'reply' or 'save_item'.

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?

No explicit guidance on when to use this tool vs. alternatives. The description does not mention prerequisites (e.g., authentication, eligibility to vote on content), nor does it clarify that votes are not allowed on own content or in archived threads. 'One vote per call' is the only usage hint.

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