Skip to main content
Glama
saralegui-solutions

MCP Self-Learning Server

trigger_learning

Manually initiate a learning cycle to analyze interactions and improve performance through pattern recognition and machine learning techniques.

Instructions

Manually trigger a learning cycle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'trigger_learning' MCP tool. It triggers a learning cycle on the LearningEngine and returns completion stats.
    async handleTriggerLearning() {
      await this.learningEngine.performLearningCycle();
      
      return {
        success: true,
        message: 'Learning cycle completed',
        stats: {
          patterns: this.learningEngine.patterns.size,
          knowledge: this.learningEngine.knowledge.size,
          cycles: this.learningEngine.metrics.learningCycles
        }
      };
    }
  • Tool definition in ListTools response, including schema with no input parameters.
    {
      name: 'trigger_learning',
      description: 'Manually trigger a learning cycle',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Registration of the tool handler in the CallToolRequestSchema switch statement.
    case 'trigger_learning':
      result = await this.handleTriggerLearning();
      break;
  • Core learning cycle implementation called by the trigger_learning handler.
    async performLearningCycle() {
      logger.info('Performing learning cycle', { cycle: this.metrics.learningCycles + 1 });
      this.metrics.learningCycles++;
    
      // Consolidate patterns
      await this.consolidatePatterns();
      
      // Update knowledge base
      await this.updateKnowledgeBase();
      
      // Optimize performance
      await this.optimizePerformance();
      
      // Prune outdated patterns
      await this.pruneOutdatedPatterns();
    
      this.emit('learning-complete', {
        cycle: this.metrics.learningCycles,
        patternsLearned: this.patterns.size,
        knowledgeItems: this.knowledge.size
      });
    }

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/saralegui-solutions/mcp-self-learning-server'

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