Skip to main content
Glama
jeebus87

reddirect

by jeebus87

Get Inbox

get_inbox

Retrieve Reddit inbox messages with filters for unread, mentions, and replies. Control the number of results.

Instructions

Get your Reddit inbox messages including unread, mentions, and comment replies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter inbox by message typeall
limitNoNumber of messages to return

Implementation Reference

  • The async handler function that executes the 'get_inbox' tool logic. It maps the filter parameter to a Reddit API endpoint, fetches messages via client.getJson(), transforms them, and returns the result.
    async ({ filter, limit }) => {
      try {
        const pathMap: Record<string, string> = {
          all: "/message/inbox",
          unread: "/message/unread",
          messages: "/message/messages",
          comment_replies: "/message/comments",
          post_replies: "/message/selfreply",
          mentions: "/message/mentions",
        };
    
        const data = await client.getJson(
          `${pathMap[filter]}.json?limit=${limit}`
        );
        const messages = (data?.data?.children || []).map((c: any) => {
          const d = c.data;
          return {
            id: d.name,
            type: d.was_comment ? "comment" : "message",
            subject: d.subject,
            author: d.author,
            body: d.body,
            is_unread: d.new,
            context_permalink: d.context
              ? `${BASE_URL}${d.context}`
              : null,
            createdUtc: d.created_utc,
          };
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({ filter, messages }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error getting inbox: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema for the 'get_inbox' tool using Zod, defining 'filter' (enum with defaults to 'all') and 'limit' (number 1-100, default 25) parameters.
    inputSchema: z.object({
      filter: z
        .enum(["all", "unread", "messages", "comment_replies", "post_replies", "mentions"])
        .default("all")
        .describe("Filter inbox by message type"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(25)
        .describe("Number of messages to return"),
    }),
  • Registration of the 'get_inbox' tool via server.registerTool() with name 'get_inbox', title, description, input schema, and handler callback.
    export function register(server: McpServer, client: RedditClient): void {
      server.registerTool(
        "get_inbox",
        {
          title: "Get Inbox",
          description:
            "Get your Reddit inbox messages including unread, mentions, and comment replies.",
          inputSchema: z.object({
            filter: z
              .enum(["all", "unread", "messages", "comment_replies", "post_replies", "mentions"])
              .default("all")
              .describe("Filter inbox by message type"),
            limit: z
              .number()
              .int()
              .min(1)
              .max(100)
              .default(25)
              .describe("Number of messages to return"),
          }),
        },
        async ({ filter, limit }) => {
          try {
            const pathMap: Record<string, string> = {
              all: "/message/inbox",
              unread: "/message/unread",
              messages: "/message/messages",
              comment_replies: "/message/comments",
              post_replies: "/message/selfreply",
              mentions: "/message/mentions",
            };
    
            const data = await client.getJson(
              `${pathMap[filter]}.json?limit=${limit}`
            );
            const messages = (data?.data?.children || []).map((c: any) => {
              const d = c.data;
              return {
                id: d.name,
                type: d.was_comment ? "comment" : "message",
                subject: d.subject,
                author: d.author,
                body: d.body,
                is_unread: d.new,
                context_permalink: d.context
                  ? `${BASE_URL}${d.context}`
                  : null,
                createdUtc: d.created_utc,
              };
            });
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify({ filter, messages }, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error getting inbox: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
              isError: true,
            };
          }
        }
      );
  • src/index.ts:32-33 (registration)
    Registration call in main entry point: registerInboxTools(server, client) which invokes the register function exported from inbox.ts.
    registerInboxTools(server, client);
    registerSubscriptionTools(server, client);
  • The getJson helper method on RedditClient used by the inbox handler to fetch data from the Reddit API with automatic token refresh on 401.
    async getJson(endpoint: string): Promise<any> {
      const res = await this.get(endpoint);
      if (res.status === 401) {
        // Token expired, retry
        this.session = null;
        await this.ensureToken();
        const retry = await this.get(endpoint);
        return retry.json();
      }
      return res.json();
    }
Behavior3/5

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

No annotations are provided, so the description must carry the full burden. It correctly indicates a read operation ('get') with no apparent side effects, but does not disclose authentication requirements, rate limits, or any potential pitfalls like empty responses.

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, well-structured sentence that conveys the core purpose without extraneous information. It is front-loaded with the primary action and object.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (2 parameters, no nested objects) and the absence of an output schema, the description provides sufficient context for a basic retrieval tool. It identifies the resource and key subtypes, though a note on expected output format would enhance completeness.

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%, and both parameters have detailed descriptions. The description's mention of specific message types ('unread, mentions, comment replies') partially overlaps with the filter enum but does not add significant new meaning beyond the schema.

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 ('get') and resource ('inbox messages'), and lists specific message types (unread, mentions, comment replies). It is specific enough to distinguish from sibling tools like 'mark_inbox_read', but does not explicitly differentiate from them.

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 usage for retrieving inbox messages but provides no explicit guidance on when to use this tool over alternatives (e.g., when to filter by specific types vs. using 'get_saved_items'). No exclusions or prerequisites are mentioned.

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