Skip to main content
Glama

get_user_info

Retrieve Reddit user information including profile details and activity data by providing a username.

Instructions

Get information about a Reddit user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesThe username of the Reddit user to get info for

Implementation Reference

  • The core handler function for the 'get_user_info' tool. It fetches user data from Reddit using the client, formats it with formatUserInfo, and returns a formatted MCP response.
    export async function getUserInfo(params: { username: string }) {
      const { username } = params;
      const client = getRedditClient();
    
      if (!client) {
        throw new McpError(
          ErrorCode.InternalError,
          "Reddit client not initialized"
        );
      }
    
      try {
        console.log(`[Tool] Getting info for u/${username}`);
        const user = await client.getUser(username);
        const formattedUser = formatUserInfo(user);
    
        return {
          content: [
            {
              type: "text",
              text: `
    # User Information: u/${formattedUser.username}
    
    ## Profile Overview
    - Username: u/${formattedUser.username}
    - Karma:
      - Comment Karma: ${formattedUser.karma.commentKarma.toLocaleString()}
      - Post Karma: ${formattedUser.karma.postKarma.toLocaleString()}
      - Total Karma: ${formattedUser.karma.totalKarma.toLocaleString()}
    - Account Status: ${formattedUser.accountStatus.join(", ")}
    - Account Created: ${formattedUser.accountCreated}
    - Profile URL: ${formattedUser.profileUrl}
    
    ## Activity Analysis
    - ${formattedUser.activityAnalysis.replace(/\n  - /g, "\n- ")}
    
    ## Recommendations
    - ${formattedUser.recommendations.replace(/\n  - /g, "\n- ")}
              `,
            },
          ],
        };
      } catch (error) {
        console.error(`[Error] Error getting user info: ${error}`);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to fetch user data: ${error}`
        );
      }
    }
  • Input schema definition for the 'get_user_info' tool, specifying the required 'username' parameter.
    inputSchema: {
      type: "object",
      properties: {
        username: {
          type: "string",
          description: "The username of the Reddit user to get info for",
        },
      },
      required: ["username"],
    },
  • src/index.ts:143-156 (registration)
    Registration of the 'get_user_info' tool in the server's listTools response, including name, description, and schema.
    {
      name: "get_user_info",
      description: "Get information about a Reddit user",
      inputSchema: {
        type: "object",
        properties: {
          username: {
            type: "string",
            description: "The username of the Reddit user to get info for",
          },
        },
        required: ["username"],
      },
    },
  • src/index.ts:443-444 (registration)
    Dispatch logic in the callTool request handler that routes 'get_user_info' calls to the tools.getUserInfo function.
    case "get_user_info":
      return await tools.getUserInfo(toolParams as { username: string });
  • Helper function formatUserInfo that processes raw Reddit user data into a formatted structure used by the handler, including activity analysis and recommendations.
    export function formatUserInfo(user: RedditUser): FormattedUserInfo {
      const status: string[] = [];
      if (user.isMod) status.push("Moderator");
      if (user.isGold) status.push("Reddit Gold Member");
      if (user.isEmployee) status.push("Reddit Employee");
    
      const accountAgeDays = (Date.now() / 1000 - user.createdUtc) / (24 * 3600); // age in days
      const karmaRatio = user.commentKarma / (user.linkKarma || 1);
    
      return {
        username: user.name,
        karma: {
          commentKarma: user.commentKarma,
          postKarma: user.linkKarma,
          totalKarma: user.totalKarma,
        },
        accountStatus: status.length ? status : ["Regular User"],
        accountCreated: formatTimestamp(user.createdUtc),
        profileUrl: user.profileUrl,
        activityAnalysis: analyzeUserActivity(
          karmaRatio,
          user.isMod,
          accountAgeDays
        ),
        recommendations: getUserRecommendations(
          karmaRatio,
          user.isMod,
          accountAgeDays
        ),
      };
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't indicate whether this is a read-only operation, what permissions might be required, whether there are rate limits, what kind of information is returned, or if there are any constraints on which users can be queried. 'Get information' implies a read operation but provides no behavioral context beyond that basic inference.

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, efficient sentence that states the core purpose without any wasted words. It's appropriately sized for a simple lookup tool and front-loads the essential information. Every word earns its place in this minimal but complete statement of function.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what information is returned about users, whether there are limitations on which users can be queried, or what format the response takes. Given the lack of structured metadata, the description should provide more context about the tool's behavior and output.

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 description doesn't mention any parameters, but the input schema has 100% description coverage with a single well-documented 'username' parameter. Since the schema fully documents the parameter, the baseline score of 3 is appropriate. The description adds no additional parameter semantics beyond what's already in 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 information') and target resource ('about a Reddit user'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'get_user_comments' or 'get_user_posts' - all three retrieve user-related data but this one is more general. The description is specific enough to understand what it does but lacks sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_user_comments', 'get_user_posts', and 'get_subreddit_info' available, there's no indication whether this tool provides comprehensive user profile data, basic metadata, or something else. The agent must infer usage context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.