get_thought_stats
Retrieve statistics about recorded thoughts to analyze patterns and usage data from the Local Utilities MCP Server.
Instructions
Get statistics about recorded thoughts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/think.ts:120-147 (handler)Inline async handler for get_thought_stats tool: computes stats from thoughts array (total count, average content length, timestamps) and returns JSON-formatted text content.const totalThoughts = thoughts.length; let statsData; // Renamed to avoid conflict with exported interface if (totalThoughts === 0) { statsData = { totalThoughts: 0, averageLength: 0, oldestThought: null, newestThought: null }; } else { const averageLength = thoughts.reduce((acc, thought) => acc + thought.content.length, 0) / totalThoughts; statsData = { totalThoughts, averageLength: parseFloat(averageLength.toFixed(2)), oldestThought: thoughts[0].timestamp, newestThought: thoughts[thoughts.length - 1].timestamp }; } return { content: [{ type: "text", text: JSON.stringify(statsData, null, 2) }] }; }
- src/mcp/think.ts:117-148 (registration)Registers the "get_thought_stats" MCP tool on the server without input parameters."get_thought_stats", "Get statistics about recorded thoughts", async () => { const totalThoughts = thoughts.length; let statsData; // Renamed to avoid conflict with exported interface if (totalThoughts === 0) { statsData = { totalThoughts: 0, averageLength: 0, oldestThought: null, newestThought: null }; } else { const averageLength = thoughts.reduce((acc, thought) => acc + thought.content.length, 0) / totalThoughts; statsData = { totalThoughts, averageLength: parseFloat(averageLength.toFixed(2)), oldestThought: thoughts[0].timestamp, newestThought: thoughts[thoughts.length - 1].timestamp }; } return { content: [{ type: "text", text: JSON.stringify(statsData, null, 2) }] }; } );
- src/mcp/think.ts:11-17 (schema)Interface defining the structure of thought statistics output (totalThoughts, averageLength, oldestThought, newestThought).export interface ThoughtStats { [key: string]: number | string | null; totalThoughts: number; averageLength: number; oldestThought: string | null; newestThought: string | null; }
- src/mcp/think.ts:38-59 (helper)getThoughtStats method in ThinkToolInternalLogic class implementing identical stats computation logic (not used in tool handler).getThoughtStats(): ThoughtStats { const totalThoughts = this.thoughts.length; if (totalThoughts === 0) { return { totalThoughts: 0, averageLength: 0, oldestThought: null, newestThought: null }; } const averageLength = this.thoughts.reduce((acc, thought) => acc + thought.content.length, 0) / totalThoughts; return { totalThoughts, averageLength: parseFloat(averageLength.toFixed(2)), // Keep formatted oldestThought: this.thoughts[0].timestamp, newestThought: this.thoughts[this.thoughts.length - 1].timestamp }; }