get_thought_stats
Retrieve and analyze statistics about recorded thoughts, enabling users to track and evaluate patterns efficiently using the Local Utilities MCP Server interface.
Instructions
Get statistics about recorded thoughts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/think.ts:119-147 (handler)The inline anonymous handler function for the get_thought_stats tool. It computes statistics (total count, average content length, timestamps of oldest/newest) from the closure-captured thoughts array and returns a text content block with JSON-formatted stats.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:116-148 (registration)Registers the get_thought_stats tool on the MCP server within the registerThinkTool function. Specifies the tool name, description, and attaches the handler function. No input schema is defined (empty args).server.tool( "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)TypeScript interface defining the shape of the statistics object returned by the get_thought_stats tool handler.export interface ThoughtStats { [key: string]: number | string | null; totalThoughts: number; averageLength: number; oldestThought: string | null; newestThought: string | null; }
- src/index.ts:25-25 (registration)Top-level call to registerThinkTool which includes registration of get_thought_stats among other think-related tools.registerThinkTool(server);