Skip to main content
Glama

custom_enhance_text

Enhance story pages by expanding text with customizable techniques including environmental details, action scenes, and prose smoothing to improve narrative quality.

Instructions

Enhances a story page using selected techniques

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe story page text to enhance
expansionTargetNoTarget expansion percentage (default: 200)
enableGoldenShadowNoEnable Golden Shadow enhancement
enableEnvironmentalNoEnable Environmental expansion
enableActionSceneNoEnable Action Scene enhancement
enableProseSmootherNoEnable Prose Smoothing
enableRepetitionEliminationNoEnable Repetition Elimination

Implementation Reference

  • Core handler function that implements the custom_enhance_text tool logic. Analyzes input text, applies selected enhancement techniques (Golden Shadow, Environmental, Action Scene, Prose Smoothing, Repetition Elimination) sequentially based on options, tracks expansion progress, generates summary, and returns enhanced text.
    async customEnhanceText( text: string, expansionTarget: number = 200, options: EnhancementOptions ): Promise<string> { // First, analyze the text to understand its characteristics const analysisReport = await this.analyzer.analyzeText(text); // Original length metrics const originalWordCount = this.analyzer.countWords(text); const originalCharCount = text.length; // Target length metrics const targetWordCount = Math.round(originalWordCount * (expansionTarget / 100)); const targetCharCount = Math.round(originalCharCount * (expansionTarget / 100)); // Track progress let enhancedText = text; let currentWordCount = originalWordCount; let currentCharCount = originalCharCount; // Apply enhancement techniques sequentially // 1. Golden Shadow Enhancement if (options.enableGoldenShadow) { enhancedText = await this.applyGoldenShadowEnhancement( enhancedText, expansionTarget, currentWordCount, targetWordCount ); currentWordCount = this.analyzer.countWords(enhancedText); currentCharCount = enhancedText.length; } // 2. Environmental Expansion if (options.enableEnvironmental) { enhancedText = await this.applyEnvironmentalExpansion( enhancedText, expansionTarget, currentWordCount, targetWordCount ); currentWordCount = this.analyzer.countWords(enhancedText); currentCharCount = enhancedText.length; } // 3. Action Scene Enhancement (if applicable) if (options.enableActionScene) { // Check if it's an action scene before applying const sceneType = this.analyzer.determineSceneType(text); if (sceneType.isAction) { enhancedText = await this.applyActionSceneEnhancement( enhancedText, expansionTarget, currentWordCount, targetWordCount ); currentWordCount = this.analyzer.countWords(enhancedText); currentCharCount = enhancedText.length; } } // 4. Prose Smoothing if (options.enableProseSmoother) { enhancedText = await this.applyProseSmoothening(enhancedText); currentWordCount = this.analyzer.countWords(enhancedText); currentCharCount = enhancedText.length; } // 5. Repetition Elimination if (options.enableRepetitionElimination) { enhancedText = await this.applyRepetitionElimination(enhancedText); } // Final word count after all enhancements const finalWordCount = this.analyzer.countWords(enhancedText); const finalCharCount = enhancedText.length; // Add enhancement summary const summary = this.generateEnhancementSummary( originalWordCount, originalCharCount, finalWordCount, finalCharCount, expansionTarget, options ); return enhancedText + '\n\n' + summary; }
  • MCP tool handler for 'custom_enhance_text'. Validates input, prepares options from arguments, calls enhancer.customEnhanceText, and formats response.
    private async handleCustomEnhanceText(args: any) { if (!args.text || typeof args.text !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Missing or invalid text parameter'); } const expansionTarget = args.expansionTarget && typeof args.expansionTarget === 'number' ? args.expansionTarget : 200; const options = { enableGoldenShadow: args.enableGoldenShadow !== false, enableEnvironmental: args.enableEnvironmental !== false, enableActionScene: args.enableActionScene !== false, enableProseSmoother: args.enableProseSmoother !== false, enableRepetitionElimination: args.enableRepetitionElimination !== false }; const result = await this.enhancer.customEnhanceText(args.text, expansionTarget, options); return { content: [ { type: 'text', text: result } ] }; }
  • JSON schema defining input parameters for custom_enhance_text tool, including text, expansionTarget, and boolean flags for each enhancement technique.
    const customEnhanceTextInputSchema = { type: 'object', properties: { text: { type: 'string', description: 'The story page text to enhance', }, expansionTarget: { type: 'number', description: 'Target expansion percentage (default: 200)', minimum: 100, maximum: 500 }, enableGoldenShadow: { type: 'boolean', description: 'Enable Golden Shadow enhancement', default: true }, enableEnvironmental: { type: 'boolean', description: 'Enable Environmental expansion', default: true }, enableActionScene: { type: 'boolean', description: 'Enable Action Scene enhancement', default: true }, enableProseSmoother: { type: 'boolean', description: 'Enable Prose Smoothing', default: true }, enableRepetitionElimination: { type: 'boolean', description: 'Enable Repetition Elimination', default: true } }, required: ['text'] };
  • src/index.ts:129-133 (registration)
    Registration of custom_enhance_text tool in the ListTools response.
    { name: 'custom_enhance_text', description: 'Enhances a story page using selected techniques', inputSchema: customEnhanceTextInputSchema }
  • src/index.ts:144-145 (registration)
    Tool dispatch in CallToolRequestHandler switch statement.
    case 'custom_enhance_text': return await this.handleCustomEnhanceText(request.params.arguments);
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/MushroomFleet/UNO-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server