improve_content
Optimize course titles and descriptions by applying content best practices to enhance clarity and engagement.
Instructions
Melhora título e descrição de um curso seguindo boas práticas
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Título atual do curso | |
| description | Yes | Descrição atual do curso |
Implementation Reference
- src/server.ts:61-72 (registration)Registration of the 'improve_content' tool in the ListTools response, including name, description, and input schema definition.{ name: 'improve_content', description: 'Melhora título e descrição de um curso seguindo boas práticas', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Título atual do curso' }, description: { type: 'string', description: 'Descrição atual do curso' }, }, required: ['title', 'description'], }, },
- src/server.ts:135-152 (handler)Primary handler function for executing the 'improve_content' tool logic. Extracts input args, invokes curation service, and formats JSON response with title and description improvements.private async handleImproveContent(args: any) { const { title, description } = args; const content = { title, description }; const result = await this.curationService.curateCourse(content); return { content: [ { type: 'text', text: JSON.stringify({ titleImprovement: result.titleImprovement, descriptionImprovement: result.descriptionImprovement, aiEnabled: this.curationService.getAIStatus().enabled }, null, 2), }, ], }; }
- src/services/ai.service.ts:119-166 (helper)Core helper function implementing AI-powered title improvement using OpenAI GPT with a tailored prompt for course title best practices.async improveTitleWithAI(title: string, description: string): Promise<{ suggestion: string; reasoning: string; improvements: string[]; } | null> { if (!this.enabled) return null; try { const prompt = ` Analise e melhore o seguinte título de curso: TÍTULO ATUAL: ${title} DESCRIÇÃO: ${description} Considere as boas práticas: - Comprimento ideal: 30-60 caracteres - Incluir nível (iniciante, intermediário, avançado) - Usar palavras-chave relevantes - Ser específico e claro - Usar números quando apropriado Responda em formato JSON: { "suggestion": "título_melhorado", "reasoning": "explicação_das_mudanças", "improvements": ["lista", "de", "melhorias", "aplicadas"] } Se o título já estiver bom, mantenha similar mas otimizado. `; const response = await this.openai.chat.completions.create({ model: this.AIMODEL, messages: [{ role: 'user', content: prompt }], temperature: 0.4, max_tokens: 250 }); const result = JSON.parse(response.choices[0].message.content || '{}'); return result; } catch (error) { console.error('Error in AI title improvement:', error); return null; } }
- src/services/ai.service.ts:168-214 (helper)Core helper function implementing AI-powered description improvement using OpenAI GPT with best practices prompt for course descriptions.async improveDescriptionWithAI(title: string, description: string): Promise<{ suggestion: string; reasoning: string; improvements: string[]; } | null> { if (!this.enabled) return null; try { const prompt = ` Melhore a seguinte descrição de curso: TÍTULO: ${title} DESCRIÇÃO ATUAL: ${description} Boas práticas para descrições: - Comprimento ideal: 100-300 caracteres - Começar com benefício/resultado - Usar verbos de ação (aprenda, domine, desenvolva) - Incluir o que será aprendido - Call-to-action sutil - Linguagem clara e envolvente Responda em formato JSON: { "suggestion": "descrição_melhorada", "reasoning": "explicação_das_mudanças", "improvements": ["lista", "de", "melhorias", "aplicadas"] } `; const response = await this.openai.chat.completions.create({ model: this.AIMODEL, messages: [{ role: 'user', content: prompt }], temperature: 0.4, max_tokens: 350 }); const result = JSON.parse(response.choices[0].message.content || '{}'); return result; } catch (error) { console.error('Error in AI description improvement:', error); return null; } }
- Service method invoked by the handler that coordinates category/tag suggestions and content improvements, calling specific improveTitle and improveDescription methods.async curateCourse(content: CourseContent): Promise<CurationSuggestion> { if (!this.aiService.isEnabled()) { throw new Error('OpenAI API key is required. Please set OPENAI_API_KEY environment variable.'); } const [ suggestedCategory, suggestedTags, titleImprovement, descriptionImprovement ] = await Promise.all([ this.suggestCategory(content), this.suggestTags(content), this.config.enableTitleSuggestions ? this.improveTitle(content.title, content.description) : Promise.resolve(undefined), this.config.enableDescriptionSuggestions ? this.improveDescription(content.title, content.description) : Promise.resolve(undefined) ]); return { suggestedCategory, suggestedTags, titleImprovement, descriptionImprovement }; }