Skip to main content
Glama
MikeyBeez

MCP Contemplation

by MikeyBeez

get_insights

Filter and retrieve processed cognitive insights by thought type, significance score, and limit from MCP Contemplation's continuous background processing for enhanced decision-making.

Instructions

Retrieve processed insights from contemplation

Input Schema

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

Implementation Reference

  • Core implementation of getInsights: prunes old insights, aggregates similar ones, filters by type and threshold, sorts by significance/recency, marks used, and returns limited 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; }
  • MCP CallToolRequest handler for 'get_insights': parses arguments, optionally sets significance threshold, calls ContemplationManager.getInsights, and returns insights as JSON text.
    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) }], }; }
  • src/index.ts:409-432 (registration)
    Tool registration in ListToolsResponse: defines name, description, and input schema for get_insights tool.
    { 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 } }, }, },
  • TypeScript interface defining the structure of Insight objects returned by getInsights.
    interface Insight { id: string; thought_type: string; content: string; significance: number; timestamp: string; used: boolean; similar_count?: number; aggregated_ids?: string[]; }
  • Helper method called by getInsights to prune old, used, or low-significance insights from memory.
    private pruneInsights(): void { const now = Date.now(); const maxAge = 24 * 60 * 60 * 1000; // 24 hours // Remove old, used, or low-significance insights this.insights = this.insights.filter(insight => { const age = now - new Date(insight.timestamp).getTime(); // Keep if: recent AND (unused OR high significance) return age < maxAge && (!insight.used || insight.significance >= 8); }); // If still too many, keep only the most significant if (this.insights.length > this.maxInsightsInMemory) { this.insights.sort((a, b) => b.significance - a.significance); this.insights = this.insights.slice(0, this.maxInsightsInMemory); } }

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

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