Skip to main content
Glama
ethancod1ng

RedNote MCP Server

by ethancod1ng

rednote_analyze_content

Analyze content for sentiment, keywords, or categories using advanced AI to extract insights from text, supporting decision-making and content strategy.

Instructions

分析内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysis_typeNo分析类型all
contentYes内容文本

Implementation Reference

  • The primary handler function for the 'rednote_analyze_content' tool. It validates the input parameters and calls the RedNoteApi to perform the content analysis, returning the result in MCP format.
    async analyzeContent(params: any) { try { validateNotEmpty(params.content, 'content'); validateString(params.content, 'content'); if (params.analysis_type) { validateEnum(params.analysis_type, 'analysis_type', ['sentiment', 'keywords', 'category', 'all']); } logger.info('Executing analyze content tool', { contentLength: params.content.length, analysisType: params.analysis_type }); const result = await this.api.analyzeContent(params.content, params.analysis_type || 'all'); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error('Error in analyzeContent tool:', error); return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • Input schema definition for the 'rednote_analyze_content' tool, specifying required 'content' parameter and optional 'analysis_type'.
    rednote_analyze_content: { name: 'rednote_analyze_content', description: '分析内容', inputSchema: { type: 'object', properties: { content: { type: 'string', description: '内容文本' }, analysis_type: { type: 'string', enum: ['sentiment', 'keywords', 'category', 'all'], description: '分析类型', default: 'all' } }, required: ['content'] } }
  • src/server.ts:73-74 (registration)
    Tool registration in the MCP server's CallToolRequestHandler switch statement, which routes calls to the AnalysisTools handler.
    case 'rednote_analyze_content': return await this.analysisTools.analyzeContent(params);
  • Helper method in RedNoteApi that implements the core content analysis logic (sentiment, keywords, category) using mock data generation.
    async analyzeContent(content: string, analysisType: string = 'all'): Promise<AnalysisResult> { logger.info('Analyzing content', { contentLength: content.length, analysisType }); try { const result: AnalysisResult = {}; if (analysisType === 'sentiment' || analysisType === 'all') { result.sentiment = { score: Math.random() * 2 - 1, label: Math.random() > 0.5 ? 'positive' : 'negative', confidence: Math.random() }; } if (analysisType === 'keywords' || analysisType === 'all') { result.keywords = this.extractKeywords(); } if (analysisType === 'category' || analysisType === 'all') { result.category = this.predictCategory(); } return result; } catch (error) { logger.error('Error analyzing content:', error); throw new Error(`Failed to analyze content: ${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