rednote_get_note
Retrieve detailed note information from Xiaohongshu (Little Red Book) by specifying a note ID. Optionally include comments for comprehensive insights.
Instructions
获取笔记详情
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_comments | No | 是否包含评论 | |
| note_id | Yes | 笔记ID |
Implementation Reference
- src/tools/content.ts:12-37 (handler)The main handler function that executes the rednote_get_note tool logic: validates parameters, calls the RedNote API, formats the response as JSON, and handles errors.async getNote(params: any) { try { validateNotEmpty(params.note_id, 'note_id'); validateString(params.note_id, 'note_id'); logger.info('Executing get note tool', { noteId: params.note_id }); const result = await this.api.getNote(params.note_id, params.include_comments || false); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in getNote tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
- src/types/mcp.ts:49-67 (schema)The input schema and metadata definition for the rednote_get_note tool, used for tool listing and validation.rednote_get_note: { name: 'rednote_get_note', description: '获取笔记详情', inputSchema: { type: 'object', properties: { note_id: { type: 'string', description: '笔记ID' }, include_comments: { type: 'boolean', description: '是否包含评论', default: false } }, required: ['note_id'] } },
- src/server.ts:61-62 (registration)The switch case in the CallToolRequest handler that registers and dispatches calls to the rednote_get_note tool handler.case 'rednote_get_note': return await this.contentTools.getNote(params);
- src/api/rednote.ts:41-51 (helper)The API helper method called by the handler to fetch note details (mock implementation).async getNote(noteId: string, includeComments: boolean = false): Promise<RedNoteNote> { logger.info('Getting note', { noteId, includeComments }); try { const mockNote = this.generateMockNote(noteId); return mockNote; } catch (error) { logger.error('Error getting note:', error); throw new Error(`Failed to get note ${noteId}: ${error}`); } }