Skip to main content
Glama
ethancod1ng

RedNote MCP Server

by ethancod1ng

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
NameRequiredDescriptionDefault
note_idYes笔记ID
include_commentsNo是否包含评论

Implementation Reference

  • 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
        };
      }
    }
  • 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);
  • 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}`);
      }
    }

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