Skip to main content
Glama

list_history

Retrieve recent music pattern history with timestamps and previews to track creative iterations and access previous work.

Instructions

List recent pattern history with timestamps and previews

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum entries to return (default: 10)

Implementation Reference

  • The handler logic for the 'list_history' tool. It checks if history exists, slices the most recent entries (default limit 10), reverses for chronological order, and returns structured data with count, previews, character counts, actions, and formatted timestamps.
    case 'list_history': if (this.historyStack.length === 0) { return 'No pattern history yet. Make some edits to build history.'; } const limit = args?.limit || 10; const recentHistory = this.historyStack.slice(-limit).reverse(); return { count: this.historyStack.length, showing: recentHistory.length, entries: recentHistory.map(entry => ({ id: entry.id, preview: entry.pattern.substring(0, 60) + (entry.pattern.length > 60 ? '...' : ''), chars: entry.pattern.length, action: entry.action, timestamp: this.formatTimeAgo(entry.timestamp) })) };
  • Registration of the 'list_history' tool in the getTools() array, including name, description, and input schema for optional 'limit' parameter.
    name: 'list_history', description: 'List recent pattern history with timestamps and previews', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum entries to return (default: 10)' } } } },
  • TypeScript interface defining the structure of HistoryEntry objects stored in the historyStack, used by list_history and related tools.
    interface HistoryEntry { id: number; pattern: string; timestamp: Date; action: string; }
  • Helper code that populates the historyStack before tool execution (on write/append/etc.), incrementing ID counter, pushing new entry, and trimming stack to prevent memory issues.
    this.historyIdCounter++; this.historyStack.push({ id: this.historyIdCounter, pattern: current, timestamp: new Date(), action: name }); // Enforce bounds to prevent memory leaks if (this.undoStack.length > this.MAX_HISTORY) { this.undoStack.shift(); } if (this.historyStack.length > this.MAX_HISTORY) { this.historyStack.shift(); } this.redoStack = [];
  • Utility function formatTimeAgo used in list_history to format timestamps as human-readable 'time ago' strings (e.g., '2m ago').
    private formatTimeAgo(date: Date): string { const seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000); if (seconds < 60) return `${seconds}s ago`; if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`; if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`; return `${Math.floor(seconds / 86400)}d ago`; }

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/williamzujkowski/strudel-mcp-server'

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