rednote_get_note
Retrieve detailed content from Xiaohongshu (Little Red Book) notes by providing a note ID, with optional comment inclusion for comprehensive analysis.
Instructions
获取笔记详情
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes | 笔记ID | |
| include_comments | No | 是否包含评论 |
Implementation Reference
- src/tools/content.ts:12-37 (handler)The main handler function for the 'rednote_get_note' tool in ContentTools class. Validates input parameters, calls the RedNote API to fetch note details, formats the response as MCP content, 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)Tool definition in TOOL_DEFINITIONS including name, description, and input schema for 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)Dispatches calls to the 'rednote_get_note' tool to the ContentTools.getNote handler within the MCP CallToolRequestSchema handler.case 'rednote_get_note': return await this.contentTools.getNote(params);
- src/api/rednote.ts:41-51 (helper)RedNoteApi.getNote method called by the tool handler; provides the core data fetching logic (mock implementation) for note details.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}`); } }