Skip to main content
Glama
MikeyBeez

MCP Contemplation

by MikeyBeez

get_insights

Retrieve processed cognitive insights from Claude's contemplation loop, filtered by thought type, significance, and quantity for analysis.

Instructions

Retrieve processed insights from contemplation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thought_typeNoFilter by thought type
limitNoMaximum insights to return (default 10)
min_significanceNoMinimum significance score 1-10 (default 5)

Implementation Reference

  • Core handler function implementing the get_insights tool logic: prunes, aggregates, filters, sorts insights by significance and recency, marks as used, and returns top results.
    async getInsights(thoughtType?: string, limit: number = 10): Promise<Insight[]> {
      // First, clean up old/low-value insights
      this.pruneInsights();
      
      // Aggregate similar insights
      this.aggregateSimilarInsights();
      
      // Filter unused insights above threshold
      let filtered = this.insights.filter(i => 
        !i.used && i.significance >= this.significanceThreshold
      );
      
      if (thoughtType) {
        filtered = filtered.filter(i => i.thought_type === thoughtType);
      }
      
      // Sort by significance and recency
      filtered.sort((a, b) => {
        // Prioritize aggregated insights
        if (a.similar_count && b.similar_count) {
          const countDiff = (b.similar_count || 1) - (a.similar_count || 1);
          if (countDiff !== 0) return countDiff;
        }
        
        if (b.significance !== a.significance) {
          return b.significance - a.significance;
        }
        return new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime();
      });
    
      // Mark as used and clean from memory
      const results = filtered.slice(0, limit);
      results.forEach(insight => {
        insight.used = true;
        // Remove high-frequency patterns after use to prevent repetition
        if (insight.similar_count && insight.similar_count > 3) {
          this.removeInsight(insight.id);
        }
      });
    
      return results;
    }
  • Input schema for the get_insights tool, defining parameters thought_type, limit, and min_significance with validation.
    inputSchema: {
      type: 'object',
      properties: {
        thought_type: {
          type: 'string',
          enum: ['pattern', 'connection', 'question', 'general'],
          description: 'Filter by thought type'
        },
        limit: {
          type: 'number',
          description: 'Maximum insights to return (default 10)'
        },
        min_significance: {
          type: 'number',
          description: 'Minimum significance score 1-10 (default 5)',
          minimum: 1,
          maximum: 10
        }
      },
    },
  • src/index.ts:409-432 (registration)
    Registration of the get_insights tool in the ListTools response, including name, description, and input schema.
    {
      name: 'get_insights',
      description: 'Retrieve processed insights from contemplation',
      inputSchema: {
        type: 'object',
        properties: {
          thought_type: {
            type: 'string',
            enum: ['pattern', 'connection', 'question', 'general'],
            description: 'Filter by thought type'
          },
          limit: {
            type: 'number',
            description: 'Maximum insights to return (default 10)'
          },
          min_significance: {
            type: 'number',
            description: 'Minimum significance score 1-10 (default 5)',
            minimum: 1,
            maximum: 10
          }
        },
      },
    },
  • src/index.ts:518-533 (registration)
    Dispatch handler in CallToolRequest that processes get_insights calls, sets threshold if provided, invokes the handler, and formats response.
    case 'get_insights': {
      const { thought_type, limit, min_significance } = args as {
        thought_type?: string;
        limit?: number;
        min_significance?: number;
      };
      
      if (min_significance) {
        contemplation.setThreshold(min_significance);
      }
      
      const insights = await contemplation.getInsights(thought_type, limit);
      return {
        content: [{ type: 'text', text: JSON.stringify(insights, null, 2) }],
      };
    }
  • Type schema for Insight objects, which are the output structure of the get_insights tool.
    interface Insight {
      id: string;
      thought_type: string;
      content: string;
      significance: number;
      timestamp: string;
      used: boolean;
      similar_count?: number;
      aggregated_ids?: string[];
    }

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/MikeyBeez/mcp-contemplation'

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