Skip to main content
Glama
ethancod1ng

RedNote MCP Server

by ethancod1ng

rednote_get_user_info

Retrieve user information from Xiaohongshu (Little Red Book) by providing a user ID or username using this tool, enabling access to profile details and insights.

Instructions

获取用户信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes用户ID或用户名

Implementation Reference

  • Input schema definition for the 'rednote_get_user_info' tool.
    rednote_get_user_info: { name: 'rednote_get_user_info', description: '获取用户信息', inputSchema: { type: 'object', properties: { user_id: { type: 'string', description: '用户ID或用户名' } }, required: ['user_id'] } },
  • src/server.ts:70-71 (registration)
    Registration/dispatch of the tool handler in the server's CallToolRequest handler switch statement.
    case 'rednote_get_user_info': return await this.userTools.getUserInfo(params);
  • Main handler function for executing the 'rednote_get_user_info' tool logic, including validation and API call.
    async getUserInfo(params: any) { try { validateNotEmpty(params.user_id, 'user_id'); validateString(params.user_id, 'user_id'); logger.info('Executing get user info tool', { userId: params.user_id }); const result = await this.api.getUserInfo(params.user_id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in getUserInfo tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • Helper API method that provides the core user info retrieval logic (mocked).
    async getUserInfo(userId: string): Promise<RedNoteUser> { logger.info('Getting user info', { userId }); try { const mockUser = this.generateMockUser(userId); return mockUser; } catch (error) { logger.error('Error getting user info:', error); throw new Error(`Failed to get user info for ${userId}: ${error}`); } }
  • Private helper function that generates mock user data used by the API method.
    private generateMockUser(id: string): RedNoteUser { const usernames = ['小红薯', '美食达人', '旅行者', '时尚博主', '生活家']; return { id, username: 'user_' + Math.random().toString(36).substring(7), nickname: usernames[Math.floor(Math.random() * usernames.length)] + Math.floor(Math.random() * 1000), avatar: 'https://example.com/avatar.jpg', description: '分享生活中的美好时光 ✨', followerCount: Math.floor(Math.random() * 10000), followingCount: Math.floor(Math.random() * 1000), noteCount: Math.floor(Math.random() * 500), likeCount: Math.floor(Math.random() * 50000), verified: Math.random() > 0.8 }; }

Other Tools

Related 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/ethancod1ng/rednote-mcp-server'

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