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}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but only states the basic action. It doesn't mention whether this is a read-only operation, potential rate limits, authentication requirements, pagination behavior, or what format/search scope the results cover. '搜索' implies querying, but no further behavioral context is provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise with a single 4-character phrase that directly conveys the core function. There's zero wasted language or unnecessary elaboration, making it highly efficient for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 4 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what kind of results to expect, how results are structured, whether there are limitations on search scope, or how this differs from other note-retrieval tools. The agent would need to guess about important behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents all 4 parameters thoroughly with descriptions, defaults, enums, and constraints. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '搜索小红书笔记' clearly states the action (搜索/search) and resource (小红书笔记/Xiaohongshu notes), making the purpose immediately understandable. However, it doesn't differentiate this search tool from sibling tools like rednote_get_note or rednote_get_user_notes, which also retrieve note-related content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when this search function is appropriate compared to rednote_get_note (for specific notes), rednote_get_user_notes (for user-specific notes), or rednote_get_trending_topics (for trending content).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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