Skip to main content
Glama

save

Store music patterns with names and tags for reuse in TidalCycles/Strudel live coding sessions.

Instructions

Save pattern with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesPattern name
tagsNo

Implementation Reference

  • Registration of the 'save' tool in getTools() array, including name, description, and input schema definition.
    name: 'save', description: 'Save pattern with metadata', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Pattern name' }, tags: { type: 'array', items: { type: 'string' } } }, required: ['name'] } },
  • Handler implementation in executeTool switch statement: validates args, retrieves current pattern, calls store.save, returns success message.
    case 'save': InputValidator.validateStringLength(args.name, 'name', 255, false); const toSave = await this.getCurrentPatternSafe(); if (!toSave) { return 'No pattern to save'; } await this.store.save(args.name, toSave, args.tags || []); return `Pattern saved as "${args.name}"`;
  • PatternStore.save method: persists pattern data as JSON file with metadata, updates cache, sanitizes filename.
    async save(name: string, content: string, tags: string[] = []): Promise<void> { await this.ensureDirectory(); const filename = this.sanitizeFilename(name) + '.json'; const filepath = path.join(this.basePath, filename); const data: PatternData = { name, content, tags, timestamp: new Date().toISOString(), }; // Update cache this.patternCache.set(name, data); this.listCache = null; // Invalidate list cache // Write file asynchronously await fs.writeFile(filepath, JSON.stringify(data, null, 2)); }

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