rednote_get_trending_topics
Discover trending topics from Xiaohongshu (Little Red Book) by category to identify popular content and discussions for analysis or inspiration.
Instructions
获取热门话题
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "rednote_get_trending_topics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | 分类 | |
| limit | No | 数量限制 |
Implementation Reference
- src/tools/content.ts:78-107 (handler)The main handler function for the 'rednote_get_trending_topics' tool. It validates optional limit parameter, logs the execution, calls the RedNoteApi to fetch trending topics, and returns the JSON-formatted result or error.
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/types/mcp.ts:107-126 (schema)The tool definition including name, description, and input schema for 'rednote_get_trending_topics' used for listing tools 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:67-68 (registration)The switch case in the CallToolRequest handler that registers and dispatches the 'rednote_get_trending_topics' tool call to the ContentTools handler.
case 'rednote_get_trending_topics': return await this.contentTools.getTrendingTopics(params);