Skip to main content
Glama
ethancod1ng

RedNote MCP Server

by ethancod1ng

rednote_get_trending_topics

Discover trending topics on Xiaohongshu with this tool by specifying a category and limit. Monitor popular content and stay updated on user interests.

Instructions

获取热门话题

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo分类
limitNo数量限制

Implementation Reference

  • The main handler function that executes the 'rednote_get_trending_topics' tool logic. Validates parameters, calls the RedNoteApi to fetch trending topics, formats the JSON response, and handles errors.
    async getTrendingTopics(params: any) { try { if (params.limit) { validateNumber(params.limit, 'limit', 1, 100); } logger.info('Executing get trending topics tool', { category: params.category, limit: params.limit }); const result = await this.api.getTrendingTopics(params.category, params.limit || 20); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in getTrendingTopics tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • src/server.ts:67-68 (registration)
    Switch case in the CallTool request handler that registers and dispatches the tool call to the ContentTools.getTrendingTopics method.
    case 'rednote_get_trending_topics': return await this.contentTools.getTrendingTopics(params);
  • Schema definition for the 'rednote_get_trending_topics' tool, including name, description, and input schema used for tool discovery and validation.
    rednote_get_trending_topics: { name: 'rednote_get_trending_topics', description: '获取热门话题', inputSchema: { type: 'object', properties: { category: { type: 'string', description: '分类' }, limit: { type: 'number', description: '数量限制', default: 20, minimum: 1, maximum: 100 } } } },
  • src/server.ts:39-49 (registration)
    Registration of the ListTools request handler that provides the tool schema from TOOL_DEFINITIONS, making the tool discoverable.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { logger.info('Listing available tools'); return { tools: Object.values(TOOL_DEFINITIONS).map(tool => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema })) }; });
  • API helper method called by the tool handler to fetch (mock) trending topics data.
    async getTrendingTopics(category?: string, limit: number = 20): Promise<RedNoteTopic[]> { logger.info('Getting trending topics', { category, limit }); try { const mockTopics = this.generateMockTopics(limit); return mockTopics; } catch (error) { logger.error('Error getting trending topics:', error); throw new Error(`Failed to get trending topics: ${error}`); } }

Other Tools

Related 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