memory_usage
Monitor system memory consumption to optimize performance and prevent crashes during music pattern generation and live coding sessions.
Instructions
Get current memory usage statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/EnhancedMCPServerFixed.ts:512-516 (registration)Registration of the 'memory_usage' tool in the getTools() method, including name, description, and empty input schema (no parameters required).{ name: 'memory_usage', description: 'Get current memory usage statistics', inputSchema: { type: 'object', properties: {} } },
- Handler implementation in executeTool switch statement. Calls perfMonitor.getMemoryUsage() and returns the memory stats as JSON or fallback message.case 'memory_usage': const memory = this.perfMonitor.getMemoryUsage(); return memory ? JSON.stringify(memory, null, 2) : 'Memory usage not available';
- Core helper method that retrieves and formats Node.js process.memoryUsage() into human-readable MB values for heapUsed, heapTotal, RSS, and external memory.getMemoryUsage() { if (typeof process !== 'undefined' && process.memoryUsage) { const usage = process.memoryUsage(); return { heapUsed: (usage.heapUsed / 1024 / 1024).toFixed(2) + ' MB', heapTotal: (usage.heapTotal / 1024 / 1024).toFixed(2) + ' MB', rss: (usage.rss / 1024 / 1024).toFixed(2) + ' MB', external: (usage.external / 1024 / 1024).toFixed(2) + ' MB' }; } return null; }