Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

get_user_info

Retrieve profile data for a Reddit user, including account details, activity statistics, and posting history.

Instructions

Get information about a Reddit user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesReddit username (without u/ prefix)

Implementation Reference

  • Core handler function that makes the Reddit API request to fetch user information and maps the response to a RedditUser object.
    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 in the listTools response, defining 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'], }, },
  • MCP CallToolRequest handler case that parses arguments, calls the RedditClient method, and formats the response.
    case 'get_user_info': { const args = GetUserInfoSchema.parse(request.params.arguments); const user = await redditClient.getUserInfo(args.username); return { content: [ { type: 'text', text: JSON.stringify(user, null, 2), }, ], }; }
  • Helper function to map raw Reddit API user data to the standardized 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