rednote_get_user_notes
Retrieve user notes from Xiaohongshu (Little Red Book) by specifying a user ID, with options for pagination and result limits.
Instructions
获取用户笔记
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | 用户ID | |
| limit | No | 数量限制 | |
| cursor | No | 分页游标 |
Implementation Reference
- src/tools/content.ts:39-76 (handler)The primary handler for the 'rednote_get_user_notes' tool. Validates input parameters, invokes the RedNote API, formats the response as MCP content, and handles errors.async getUserNotes(params: any) { try { validateNotEmpty(params.user_id, 'user_id'); validateString(params.user_id, 'user_id'); if (params.limit) { validateNumber(params.limit, 'limit', 1, 100); } logger.info('Executing get user notes tool', { userId: params.user_id, limit: params.limit, cursor: params.cursor }); const result = await this.api.getUserNotes( params.user_id, params.limit || 20, params.cursor ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in getUserNotes tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
- src/types/mcp.ts:82-106 (schema)The input schema and metadata definition for the 'rednote_get_user_notes' tool, used for tool listing and validation.rednote_get_user_notes: { name: 'rednote_get_user_notes', description: '获取用户笔记', inputSchema: { type: 'object', properties: { user_id: { type: 'string', description: '用户ID' }, limit: { type: 'number', description: '数量限制', default: 20, minimum: 1, maximum: 100 }, cursor: { type: 'string', description: '分页游标' } }, required: ['user_id'] } },
- src/server.ts:64-65 (registration)The switch case in the tool request handler that routes calls to the 'rednote_get_user_notes' tool to its implementation.case 'rednote_get_user_notes': return await this.contentTools.getUserNotes(params);