Skip to main content
Glama
MushroomFleet

TranscriptionTools MCP Server

summary_text

Generate concise summaries from text or files using ACE cognitive methodology. Specify constraints like time, characters, or words for tailored output. Ideal for efficient transcript and content processing.

Instructions

Generates intelligent summaries using ACE cognitive methodology

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
constraint_typeNoType of constraint to apply
constraint_valueNoValue for the specified constraint
input_textYesText to summarize or path to file
is_file_pathNoWhether input_text is a file path

Implementation Reference

  • The primary handler function for the 'summary_text' tool. It processes input text (direct or from file), applies configurable constraints (time, chars, words), and generates a summary using simulated ACE cognitive methodology: priming, comprehension, context clarification, expansion, and recursive refinement stages. Uses sentence importance scoring and selection to meet target lengths.
    export async function summaryText(params: SummaryTextParams): Promise<{ summary: string }> {
      try {
        const { 
          input_text, 
          is_file_path = false, 
          constraint_type = null,
          constraint_value = null
        } = params;
        
        // Resolve content (either direct text or from file)
        const textContent = await FileHandler.resolveTextContent(input_text, is_file_path);
        
        // Create a session ID and logger
        const logger = new Logger();
        const sessionId = logger.getSessionId();
        
        // In a real implementation, this would be a sophisticated NLP pipeline
        // using deep learning models for summarization. Here we'll simulate the process.
        
        // ACE-Driven Processing
        // Step 1: Priming Stage
        const contentLength = textContent.length;
        const wordCount = textContent.split(/\s+/).length;
        
        // Determine target length based on constraint
        let targetLength: number;
        if (constraint_type === 'time') {
          // Base rate: 150 words/minute
          const baseRate = 150;
          targetLength = constraint_value ? constraint_value * baseRate / 60 : wordCount * 0.3;
        } else if (constraint_type === 'chars') {
          targetLength = constraint_value ? constraint_value : contentLength * 0.3;
        } else if (constraint_type === 'words') {
          targetLength = constraint_value ? constraint_value : wordCount * 0.3;
        } else {
          // Default constraint: 30% of original
          targetLength = wordCount * 0.3;
        }
        
        // Simulate domain context identification
        const primingFactors = [
          'Document length analysis',
          'Content type recognition',
          'Terminological evaluation',
          'Priority patterns identified'
        ];
        
        // Step 2: Comprehension Stage
        const paragraphs = textContent.split(/\n\n+/);
        
        // Simulate comprehension metrics
        const comprehensionMetrics = {
          coreThemeCount: Math.min(5, paragraphs.length),
          relationshipNodes: paragraphs.length * 2,
          causalChains: Math.floor(paragraphs.length / 2),
          hierarchyLevels: 3
        };
        
        // Step 3: Context Clarification Stage
        const sentences = textContent.match(/[^.!?]+[.!?]+/g) || [];
        
        // Map importance scores to sentences (simulated)
        const sentenceScores = sentences.map((sentence, index) => {
          // In a real implementation, this would use NLP models to score importance
          // Here we'll use position and length as proxies for importance
          const positionScore = 1 - (index / sentences.length); // Early sentences get higher scores
          const lengthScore = Math.min(1, sentence.length / 100); // Longer sentences (up to a point) get higher scores
          return { sentence, score: (positionScore * 0.7) + (lengthScore * 0.3) };
        });
        
        // Sort by importance score
        sentenceScores.sort((a, b) => b.score - a.score);
        
        // Simulated context maps 
        const contextMaps = {
          semanticUnits: sentences.length,
          densityEvaluation: 'Completed',
          dependencyGraph: 'Generated',
          narrativeThreads: 'Mapped'
        };
        
        // Step 4: Expanding Stage
        // Select top sentences based on constraint
        let selectedSentences: string[] = [];
        let currentLength = 0;
        const targetMetric = constraint_type === 'chars' ? 'chars' : 'words';
        
        // Keep adding sentences until we hit the target length
        for (const item of sentenceScores) {
          const sentenceLength = targetMetric === 'chars' 
            ? item.sentence.length 
            : item.sentence.split(/\s+/).length;
            
          if (currentLength + sentenceLength <= targetLength) {
            selectedSentences.push(item.sentence);
            currentLength += sentenceLength;
          } else if (selectedSentences.length === 0) {
            // Always include at least one sentence
            selectedSentences.push(item.sentence);
            break;
          } else {
            break;
          }
        }
        
        // Step 5: Recursive Stage
        // In a real implementation, this would iteratively refine the summary
        // For simulation, we'll just reorder the sentences to follow the original text flow
        
        // Get original order of selected sentences
        const sentenceIndexes = selectedSentences.map(sentence => {
          return sentences.findIndex(s => s === sentence);
        });
        
        // Sort by original position
        const sortedIndexes = [...sentenceIndexes].sort((a, b) => a - b);
        selectedSentences = sortedIndexes.map(index => {
          return sentences[index];
        });
        
        // Join the selected sentences to form the summary
        let summary = selectedSentences.join(' ').trim();
        
        // Simulate refinement
        const expansionIterations = 3;
        const recursiveOptimizations = 2;
        
        // Log the summary process
        const constraintDetails = {
          type: constraint_type,
          target: constraint_value,
          achieved: currentLength
        };
        
        const processStats = {
          primingFactors,
          comprehensionMetrics,
          contextMaps,
          expansionIterations,
          recursiveOptimizations
        };
        
        await logger.logSummaryProcess(constraintDetails, processStats);
        
        return { summary };
      } catch (error) {
        throw new Error(`Summary process failed: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • TypeScript interface defining the input parameters for the summaryText handler.
    export interface SummaryTextParams {
      input_text: string;
      is_file_path?: boolean;
      constraint_type?: 'time' | 'chars' | 'words' | null;
      constraint_value?: number | null;
    }
  • src/index.ts:117-144 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and JSON inputSchema matching SummaryTextParams.
    {
      name: 'summary_text',
      description: 'Generates intelligent summaries using ACE cognitive methodology',
      inputSchema: {
        type: 'object',
        properties: {
          input_text: {
            type: 'string',
            description: 'Text to summarize or path to file'
          },
          is_file_path: {
            type: 'boolean',
            description: 'Whether input_text is a file path',
            default: false
          },
          constraint_type: {
            type: 'string',
            enum: ['time', 'chars', 'words', null],
            description: 'Type of constraint to apply'
          },
          constraint_value: {
            type: 'number',
            description: 'Value for the specified constraint'
          }
        },
        required: ['input_text']
      }
    }
  • src/index.ts:200-213 (registration)
    Dispatch case in the CallToolRequestSchema handler that validates arguments and invokes the summaryText handler, returning the summary as MCP content.
    case 'summary_text':
      // Validate required parameters
      if (!args || typeof args.input_text !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: input_text');
      }
      const summaryResult = await summaryText(args as unknown as SummaryTextParams);
      return {
        content: [
          {
            type: 'text',
            text: summaryResult.summary
          }
        ]
      };
  • JSON schema for input validation in the tool registration, mirroring the SummaryTextParams interface.
    inputSchema: {
      type: 'object',
      properties: {
        input_text: {
          type: 'string',
          description: 'Text to summarize or path to file'
        },
        is_file_path: {
          type: 'boolean',
          description: 'Whether input_text is a file path',
          default: false
        },
        constraint_type: {
          type: 'string',
          enum: ['time', 'chars', 'words', null],
          description: 'Type of constraint to apply'
        },
        constraint_value: {
          type: 'number',
          description: 'Value for the specified constraint'
        }
      },
      required: ['input_text']
    }
Install Server

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/MushroomFleet/TranscriptionTools-MCP'

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