Skip to main content
Glama

Decent-Sampler Drums MCP Server

configure_round_robin

Set up round robin playback for sample sequences by validating positions, checking file existence, and generating XML structures. Ensures proper sample grouping and mode compliance (round_robin, random, true_random, always) for accurate playback.

Instructions

Configure round robin sample playback for a set of samples.

This tool will:

  • Validate sequence positions

  • Verify sample files exist

  • Generate proper XML structure for round robin playback

Error Handling:

  • Checks if sample files exist at specified paths

  • Validates sequence positions are unique and sequential

  • Ensures mode is one of: round_robin, random, true_random, always

  • Returns specific error messages for missing files or invalid sequences

Success Response: Returns XML structure with:

  • Configured playback mode

  • Sample sequence assignments

  • Proper group organization for round robin playback

Input Schema

NameRequiredDescriptionDefault
directoryYesAbsolute path to the directory containing samples
lengthYesNumber of round robin variations
modeYesRound robin playback mode
samplesYes

Input Schema (JSON Schema)

{ "properties": { "directory": { "description": "Absolute path to the directory containing samples", "type": "string" }, "length": { "description": "Number of round robin variations", "type": "number" }, "mode": { "description": "Round robin playback mode", "enum": [ "round_robin", "random", "true_random", "always" ], "type": "string" }, "samples": { "items": { "properties": { "path": { "description": "Path to sample file (relative to directory)", "type": "string" }, "seqPosition": { "description": "Position in the round robin sequence (1 to length)", "type": "number" } }, "required": [ "path", "seqPosition" ], "type": "object" }, "type": "array" } }, "required": [ "directory", "mode", "length", "samples" ], "type": "object" }

Implementation Reference

  • The core handler function configureRoundRobin that validates round robin configuration (modes, sequence positions, file existence) and generates AdvancedDrumKitConfig for XML generation.
    export function configureRoundRobin(directory: string, config: RoundRobinConfig): AdvancedDrumKitConfig { // If mode is not 'always', ensure seqPosition is provided at some level if (config.mode !== 'always') { for (const group of config.groups) { const hasGroupSeqPos = group.settings?.seqPosition !== undefined; for (const sample of group.samples) { if (!hasGroupSeqPos && !sample.seqPosition && !sample.settings?.seqPosition) { throw new Error( `Sample ${sample.path} needs a seqPosition when mode is ${config.mode}. ` + 'Provide it at sample, group, or global level.' ); } } } } // If length is provided, validate sequence positions if (config.length !== undefined) { for (const group of config.groups) { for (const sample of group.samples) { const seqPos = sample.seqPosition || sample.settings?.seqPosition || group.settings?.seqPosition; if (seqPos !== undefined && (seqPos < 1 || seqPos > config.length)) { throw new Error( `Invalid sequence position ${seqPos} for sample ${sample.path}. ` + `Must be between 1 and ${config.length}` ); } } } } // Verify all files exist for (const group of config.groups) { for (const sample of group.samples) { const fullPath = path.join(directory, sample.path); if (!fs.existsSync(fullPath)) { throw new Error(`Sample file not found: ${sample.path}`); } } } // Create the drum kit configuration return { globalSettings: { roundRobin: { mode: config.mode, ...(config.length !== undefined && { length: config.length }) } }, drumPieces: config.groups.map(group => ({ name: group.name, rootNote: group.rootNote || 60, ...(group.settings && { seqMode: group.settings.mode, ...(group.settings.length !== undefined && { seqLength: group.settings.length }), ...(group.settings.seqPosition !== undefined && { seqPosition: group.settings.seqPosition }) }), samples: group.samples.map(sample => ({ path: sample.path, ...(sample.seqPosition !== undefined && { seqPosition: sample.seqPosition }), ...(sample.settings && { seqMode: sample.settings.mode, ...(sample.settings.length !== undefined && { seqLength: sample.settings.length }), ...(sample.settings.seqPosition !== undefined && { seqPosition: sample.settings.seqPosition }) }) })) })) }; }
  • MCP tool schema definition including inputSchema for 'configure_round_robin' with properties for directory, mode, length, and samples array.
    name: "configure_round_robin", description: `Configure round robin sample playback for a set of samples. This tool will: - Validate sequence positions - Verify sample files exist - Generate proper XML structure for round robin playback Error Handling: - Checks if sample files exist at specified paths - Validates sequence positions are unique and sequential - Ensures mode is one of: round_robin, random, true_random, always - Returns specific error messages for missing files or invalid sequences Success Response: Returns XML structure with: - Configured playback mode - Sample sequence assignments - Proper group organization for round robin playback`, inputSchema: { type: "object", properties: { directory: { type: "string", description: "Absolute path to the directory containing samples" }, mode: { type: "string", enum: ["round_robin", "random", "true_random", "always"], description: "Round robin playback mode" }, length: { type: "number", description: "Number of round robin variations" }, samples: { type: "array", items: { type: "object", properties: { path: { type: "string", description: "Path to sample file (relative to directory)" }, seqPosition: { type: "number", description: "Position in the round robin sequence (1 to length)" } }, required: ["path", "seqPosition"] } } }, required: ["directory", "mode", "length", "samples"] } },
  • src/index.ts:551-598 (registration)
    Tool registration in the CallToolRequestSchema handler: validates input arguments, constructs RoundRobinConfig, calls configureRoundRobin, generates and returns XML.
    case "configure_round_robin": { const args = request.params.arguments; if (!args || typeof args !== 'object' || typeof args.directory !== 'string' || typeof args.mode !== 'string' || typeof args.length !== 'number' || !Array.isArray(args.samples)) { throw new McpError( ErrorCode.InvalidParams, "Invalid arguments: expected object with directory, mode, length, and samples" ); } if (!['round_robin', 'random', 'true_random', 'always'].includes(args.mode)) { throw new McpError( ErrorCode.InvalidParams, "Invalid mode: must be one of 'round_robin', 'random', 'true_random', 'always'" ); } try { const config = configureRoundRobin(args.directory, { mode: args.mode as "round_robin" | "random" | "true_random" | "always", length: args.length, groups: [{ name: "Samples", samples: args.samples.map(s => ({ path: String(s.path), seqPosition: Number(s.seqPosition) })) }] }); const xml = generateGroupsXml(config); return { content: [{ type: "text", text: xml }] }; } catch (error: unknown) { if (error instanceof McpError) throw error; const message = error instanceof Error ? error.message : String(error); throw new McpError( ErrorCode.InternalError, `Failed to configure round robin: ${message}` ); } }
  • Type definitions for RoundRobinConfig and supporting interfaces used by the configureRoundRobin handler.
    export type RoundRobinMode = "round_robin" | "random" | "true_random" | "always"; export interface RoundRobinSettings { mode: RoundRobinMode; length?: number; // Optional: DecentSampler can auto-detect seqPosition?: number; // For group-level settings } export interface RoundRobinSample { path: string; seqPosition?: number; // Optional at sample level if group has seqPosition settings?: RoundRobinSettings; // Optional per-sample settings } export interface RoundRobinGroup { name: string; rootNote?: number; settings?: RoundRobinSettings; // Optional per-group settings samples: RoundRobinSample[]; } export interface RoundRobinConfig { mode: RoundRobinMode; length?: number; // Optional: DecentSampler can auto-detect groups: RoundRobinGroup[]; }

Other Tools

Related Tools

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/dandeliongold/mcp-decent-sampler-drums'

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