Skip to main content
Glama

get_user_profile

Retrieve detailed Reddit user profile information, including karma, account age, gold status, moderator status, and profile link, by providing the username without the 'u/' prefix.

Instructions

πŸ‘€ Get Reddit user profile information 🎯 What it does: Fetches detailed profile info for any Reddit user πŸ“ Required: username (Reddit username without u/ prefix) πŸ’‘ Examples: β€’ Get profile: {"username": "spez"} β€’ Check user: {"username": "AwkwardTension4482"} β€’ View profile: {"username": "gallowboob"} πŸ” Output: User info with karma, account age, gold status, moderator status, and profile link

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesReddit username to get profile information

Implementation Reference

  • MCP tool handler for get_user_profile: extracts username from params, calls redditAPI.getUserProfile, handles errors, formats user data with formatUserProfile, and returns standardized MCP success response.
    createToolHandler(async (params: z.infer<typeof SimpleUserProfileSchema>) => { const { username } = params; const result = await redditAPI.getUserProfile(username); if (!result.success) { return createErrorResponse("Error getting user profile", result.error); } const data = result.data; if (!data || !data.data) { return createErrorResponse("User profile not found"); } const user = data.data; const userInfo = formatUserProfile(user); return createSuccessResponse(userInfo); })
  • src/index.ts:527-557 (registration)
    Registers the get_user_profile tool with the MCP server, providing name, description, input schema (SimpleUserProfileSchema), and handler function.
    server.tool( "get_user_profile", "πŸ‘€ Get Reddit user profile information\n" + "🎯 What it does: Fetches detailed profile info for any Reddit user\n" + "πŸ“ Required: username (Reddit username without u/ prefix)\n" + "πŸ’‘ Examples:\n" + " β€’ Get profile: {\"username\": \"spez\"}\n" + " β€’ Check user: {\"username\": \"AwkwardTension4482\"}\n" + " β€’ View profile: {\"username\": \"gallowboob\"}\n" + "πŸ” Output: User info with karma, account age, gold status, moderator status, and profile link", SimpleUserProfileSchema.shape, createToolHandler(async (params: z.infer<typeof SimpleUserProfileSchema>) => { const { username } = params; const result = await redditAPI.getUserProfile(username); if (!result.success) { return createErrorResponse("Error getting user profile", result.error); } const data = result.data; if (!data || !data.data) { return createErrorResponse("User profile not found"); } const user = data.data; const userInfo = formatUserProfile(user); return createSuccessResponse(userInfo); }) );
  • Zod schema for input validation of get_user_profile tool: requires 'username' string parameter.
    export const SimpleUserProfileSchema = z.object({ username: z.string().describe("Reddit username to get profile information") });
  • Helper method in RedditAPIService that makes the actual API request to fetch user profile data from Reddit's /user/{username}/about.json endpoint.
    async getUserProfile(username: string): Promise<ApiCallResult> { return this.makeRequest<{ data: RedditUser }>( `/user/${username}/about.json`, ); }
  • Helper function to format RedditUser data into a human-readable markdown string with emojis, used in the tool handler.
    function formatUserProfile(user: RedditUser): string { const name = user.name || 'Unknown'; const linkKarma = user.link_karma || 0; const commentKarma = user.comment_karma || 0; const createdDate = user.created_utc ? new Date(user.created_utc * 1000).toLocaleDateString() : 'Unknown'; const isGold = user.is_gold || false; const isMod = user.is_mod || false; const hasVerifiedEmail = user.has_verified_email || false; let result = `πŸ‘€ **u/${name}**\n`; result += `πŸ“Š Link Karma: ${linkKarma.toLocaleString()}\n`; result += `πŸ’¬ Comment Karma: ${commentKarma.toLocaleString()}\n`; result += `πŸ“… Created: ${createdDate}\n`; result += `πŸ₯‡ Gold: ${isGold ? 'Yes' : 'No'}\n`; result += `πŸ›‘οΈ Moderator: ${isMod ? 'Yes' : 'No'}\n`; result += `βœ… Verified Email: ${hasVerifiedEmail ? 'Yes' : 'No'}\n`; result += `πŸ”— Profile: https://reddit.com/user/${name}\n`; return result; }

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

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