get_thought_stats
Analyze and evaluate your thinking process by retrieving statistical insights from recorded thoughts during the current session with structured reasoning support.
Instructions
Get statistics about the thoughts recorded in the current session to analyze your thinking process.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:93-123 (handler)The core handler function for the get_thought_stats tool. Computes statistics like total thoughts, average length, longest thought details from the thoughtsLog and returns as JSON.async () => { if (this.thoughtsLog.length === 0) { return { content: [{ type: "text", text: "No thoughts have been recorded yet." }] }; } const totalThoughts = this.thoughtsLog.length; const avgLength = this.thoughtsLog.reduce((sum, entry) => sum + entry.thought.length, 0) / totalThoughts; let longestThoughtIndex = 0; let longestThoughtLength = 0; this.thoughtsLog.forEach((entry, index) => { if (entry.thought.length > longestThoughtLength) { longestThoughtLength = entry.thought.length; longestThoughtIndex = index; } }); const stats = { total_thoughts: totalThoughts, average_length: Math.round(avgLength * 100) / 100, longest_thought_index: longestThoughtIndex + 1, longest_thought_length: longestThoughtLength }; return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] }; }
- src/index.ts:89-124 (registration)Registration of the get_thought_stats tool via this.server.tool(), including name, description, and inline handler (no input schema).// Register the get_thought_stats tool this.server.tool( "get_thought_stats", "Get statistics about the thoughts recorded in the current session to analyze your thinking process.", async () => { if (this.thoughtsLog.length === 0) { return { content: [{ type: "text", text: "No thoughts have been recorded yet." }] }; } const totalThoughts = this.thoughtsLog.length; const avgLength = this.thoughtsLog.reduce((sum, entry) => sum + entry.thought.length, 0) / totalThoughts; let longestThoughtIndex = 0; let longestThoughtLength = 0; this.thoughtsLog.forEach((entry, index) => { if (entry.thought.length > longestThoughtLength) { longestThoughtLength = entry.thought.length; longestThoughtIndex = index; } }); const stats = { total_thoughts: totalThoughts, average_length: Math.round(avgLength * 100) / 100, longest_thought_index: longestThoughtIndex + 1, longest_thought_length: longestThoughtLength }; return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] }; } );
- src/index.ts:8-11 (helper)Interface defining ThoughtRecord used by get_thought_stats and other tools to structure log entries.interface ThoughtRecord { timestamp: string; thought: string; }