Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

get_user_info

Retrieve Reddit user profile information including account details, karma, and activity history by providing a username.

Instructions

Get information about a Reddit user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesReddit username (without u/ prefix)

Implementation Reference

  • The core handler function that fetches user information from the Reddit API endpoint `/user/{username}/about` and maps the response data to a RedditUser object using the mapUser helper.
    async getUserInfo(username: string): Promise<RedditUser> { const data = await this.makeRequest(`/user/${username}/about`); return this.mapUser(data.data); }
  • Zod schema for validating the input parameters (username) of the get_user_info tool.
    const GetUserInfoSchema = z.object({ username: z.string().min(1, "Username is required"), });
  • src/index.ts:164-177 (registration)
    Tool registration entry in the MCP server's listTools handler, defining the tool's name, description, and input schema.
    { name: 'get_user_info', description: 'Get information about a Reddit user', inputSchema: { type: 'object', properties: { username: { type: 'string', description: 'Reddit username (without u/ prefix)', }, }, required: ['username'], }, },
  • TypeScript interface defining the structure of the Reddit user information returned by the handler.
    export interface RedditUser { name: string; id: string; created_utc: number; comment_karma: number; link_karma: number; is_verified: boolean; has_verified_email: boolean; }
  • Helper function that maps raw Reddit API user data to the structured RedditUser interface.
    private mapUser(data: any): RedditUser { return { name: data.name, id: data.id, created_utc: data.created_utc, comment_karma: data.comment_karma, link_karma: data.link_karma, is_verified: data.is_verified, has_verified_email: data.has_verified_email, }; }

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

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