Skip to main content
Glama
jeebus87

reddirect

by jeebus87

Check Reddit Session

check_session

Confirm whether you are connected to a Reddit account. Displays your username if authorized, or shows anonymous status.

Instructions

Check if connected to a Reddit account. Shows username if authorized, or anonymous if not. Run 'authorize' tool to connect your account for write operations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the check_session tool. Calls ensureToken() to get a valid token, then checks whether the session is authenticated (has a username) or anonymous. Returns a JSON response with status, username, and read/write capabilities.
      async () => {
        try {
          await client.ensureToken();
          const username = client.getUsername();
          const authenticated = client.isAuthenticated();
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    status: authenticated ? "authenticated" : "anonymous",
                    username,
                    can_read: true,
                    can_write: authenticated,
                    message: authenticated
                      ? `Connected as u/${username}. Full read/write access.`
                      : "Anonymous mode. Reads work. Run 'authorize' to enable writes.",
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  status: "error",
                  error: error instanceof Error ? error.message : String(error),
                }, null, 2),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Schema/definition for the check_session tool. It has an empty input schema (no parameters), a title, and a description.
    {
      title: "Check Reddit Session",
      description:
        "Check if connected to a Reddit account. Shows username if authorized, or anonymous if not. Run 'authorize' tool to connect your account for write operations.",
      inputSchema: z.object({}),
  • src/tools/auth.ts:6-54 (registration)
    Registration of the check_session tool on the MCP server via server.registerTool() in the auth module's register function.
    server.registerTool(
      "check_session",
      {
        title: "Check Reddit Session",
        description:
          "Check if connected to a Reddit account. Shows username if authorized, or anonymous if not. Run 'authorize' tool to connect your account for write operations.",
        inputSchema: z.object({}),
      },
      async () => {
        try {
          await client.ensureToken();
          const username = client.getUsername();
          const authenticated = client.isAuthenticated();
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    status: authenticated ? "authenticated" : "anonymous",
                    username,
                    can_read: true,
                    can_write: authenticated,
                    message: authenticated
                      ? `Connected as u/${username}. Full read/write access.`
                      : "Anonymous mode. Reads work. Run 'authorize' to enable writes.",
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  status: "error",
                  error: error instanceof Error ? error.message : String(error),
                }, null, 2),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper method on RedditClient that returns whether the session has a username (i.e., is authenticated). Used by the check_session handler.
    isAuthenticated(): boolean {
      return !!this.session?.username;
    }
  • Helper method on RedditClient that returns the username or '(anonymous)' if not authenticated. Used by the check_session handler.
    getUsername(): string {
      return this.session?.username || "(anonymous)";
    }
Behavior4/5

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

With no annotations, the description discloses the read-only nature and output behavior (username vs anonymous). It adds value by clarifying the tool's state query without side effects.

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 concise sentences that front-load the core purpose, with no wasted words.

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

Completeness5/5

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

Given no parameters or output schema, the description fully explains the tool's function and how it integrates with the sibling 'authorize' tool, making it complete for its simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist; the empty schema is fully covered. The description doesn't need to add parameter details, and the baseline for 0 params is 4.

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 tool checks Reddit connection, showing authorized username or anonymous status. This distinguishes it from sibling tools like 'authorize' which handles authentication.

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

Usage Guidelines5/5

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

Explicitly states when to use (to check connection) and directs to 'authorize' tool for write operations, providing clear context and alternatives.

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