Skip to main content
Glama
ethancod1ng

RedNote MCP Server

by ethancod1ng

rednote_search_notes

Search Xiaohongshu (Little Red Book) notes by keyword to find relevant content, videos, or all types with customizable sorting and result limits.

Instructions

搜索小红书笔记

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词
typeNo内容类型all
sortNo排序方式relevant
limitNo返回数量限制

Implementation Reference

  • The primary handler for the rednote_search_notes MCP tool. It processes parameters, logs the action, calls the RedNoteApi to search notes, and formats the response.
    async searchNotes(params: any) { try { validateSearchParams(params); const searchParams = { keyword: params.keyword, type: params.type || 'all', sort: params.sort || 'relevant', limit: params.limit || 20 }; logger.info('Executing search notes tool', { params: searchParams }); const result = await this.api.searchNotes(searchParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in searchNotes tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • Input schema defining parameters (keyword required, type/sort/limit optional) and validation rules for the tool.
    rednote_search_notes: { name: 'rednote_search_notes', description: '搜索小红书笔记', inputSchema: { type: 'object', properties: { keyword: { type: 'string', description: '搜索关键词' }, type: { type: 'string', enum: ['note', 'video', 'all'], description: '内容类型', default: 'all' }, sort: { type: 'string', enum: ['latest', 'popular', 'relevant'], description: '排序方式', default: 'relevant' }, limit: { type: 'number', description: '返回数量限制', default: 20, minimum: 1, maximum: 100 } }, required: ['keyword'] } },
  • src/server.ts:57-59 (registration)
    Tool registration in the MCP server's CallToolRequest handler switch statement, routing calls to the SearchTools.searchNotes method.
    switch (name) { case 'rednote_search_notes': return await this.searchTools.searchNotes(params);
  • Helper function specifically for validating search notes parameters against the schema rules.
    export function validateSearchParams(params: any): void { validateNotEmpty(params.keyword, 'keyword'); validateString(params.keyword, 'keyword'); if (params.type) { validateEnum(params.type, 'type', ['note', 'video', 'all']); } if (params.sort) { validateEnum(params.sort, 'sort', ['latest', 'popular', 'relevant']); } if (params.limit) { validateNumber(params.limit, 'limit', 1, 100); } }
  • API layer implementation of searchNotes (currently using mock data generation). Called by the tool handler.
    async searchNotes(params: SearchParams): Promise<SearchResult> { logger.info('Searching notes', { params }); try { const mockResult: SearchResult = { notes: this.generateMockNotes(params.limit || 20), hasMore: true, nextCursor: 'mock_cursor_' + Date.now(), total: 1000 }; return mockResult; } catch (error) { logger.error('Error searching notes:', error); throw new Error(`Failed to search notes: ${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