Skip to main content
Glama
jordanburke

reddit-mcp-server

get_user_info

Retrieve Reddit user profile information including karma, account age, and post history 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

  • Handler function that executes the get_user_info tool: fetches Reddit user data using the client, formats it with formatUserInfo, and returns formatted markdown string.
      execute: async (args) => {
        const client = getRedditClient()
        if (!client) {
          throw new Error("Reddit client not initialized")
        }
    
        const user = await client.getUser(args.username)
        const formattedUser = formatUserInfo(user)
    
        return `# 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 {2}- /g, "\n- ")}`
      },
  • Zod input schema defining the 'username' parameter for the get_user_info tool.
    parameters: z.object({
      username: z.string().describe("The Reddit username (without u/ prefix)"),
    }),
  • src/index.ts:144-177 (registration)
    Registration of the get_user_info tool with FastMCP server.addTool call.
    server.addTool({
      name: "get_user_info",
      description: "Get detailed information about a Reddit user including karma, account status, and activity analysis",
      parameters: z.object({
        username: z.string().describe("The Reddit username (without u/ prefix)"),
      }),
      execute: async (args) => {
        const client = getRedditClient()
        if (!client) {
          throw new Error("Reddit client not initialized")
        }
    
        const user = await client.getUser(args.username)
        const formattedUser = formatUserInfo(user)
    
        return `# 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 {2}- /g, "\n- ")}`
      },
    })
  • Helper function formatUserInfo that structures and analyzes Reddit user data, used in the get_user_info handler.
    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),
      }
    }
  • TypeScript interface defining the formatted user info structure returned by formatUserInfo.
    export interface FormattedUserInfo {
      username: string
      karma: {
        commentKarma: number
        postKarma: number
        totalKarma: number
      }
      accountStatus: string[]
      accountCreated: string
      profileUrl: string
      activityAnalysis: string
      recommendations: string
    }
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.

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/jordanburke/reddit-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server