Skip to main content
Glama
dandeliongold

Decent-Sampler Drums MCP Server

configure_drum_controls

Set up pitch and envelope controls for drum types in DecentSampler, generating XML with MIDI CC mappings for real-time adjustments.

Instructions

Configure global pitch and envelope controls for each drum type.

This tool will:

  • Add per-drum pitch controls with customizable ranges

  • Configure ADSR envelope settings for natural decay control

  • Generate proper XML structure for global drum controls

Error Handling:

  • Validates pitch range values (min/max must be valid numbers)

  • Ensures envelope times are positive values

  • Verifies curve values are within -100 to 100 range

  • Returns detailed error messages for invalid configurations

Success Response: Returns XML structure containing:

  • Global controls for each drum type

  • MIDI CC mappings for real-time control

  • Properly formatted parameter bindings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drumControlsYes

Implementation Reference

  • The core handler function that validates and configures drum controls (pitch and envelope) for each drum, producing an AdvancedDrumKitConfig object.
    export function configureDrumControls(config: DrumControlsConfig): AdvancedDrumKitConfig {
      // Validate all drum configurations
      for (const drum of config.drums) {
        validatePitchSettings(drum);
        validateEnvelopeSettings(drum);
      }
    
      // Create the drum kit configuration
      return {
        globalSettings: {
          drumControls: config.drums.reduce((acc, drum) => ({
            ...acc,
            [drum.name]: {
              ...(drum.pitch && { pitch: drum.pitch }),
              ...(drum.envelope && { envelope: drum.envelope })
            }
          }), {})
        },
        drumPieces: config.drums.map(drum => ({
          name: drum.name,
          rootNote: drum.rootNote,
          samples: [] // Let caller provide samples
        }))
      };
    }
  • src/index.ts:103-189 (registration)
    MCP tool registration in ListToolsRequestHandler, defining the tool name, description, and JSON input schema for validation.
          {
            name: "configure_drum_controls",
            description: `Configure global pitch and envelope controls for each drum type.
    
    This tool will:
    - Add per-drum pitch controls with customizable ranges
    - Configure ADSR envelope settings for natural decay control
    - Generate proper XML structure for global drum controls
    
    Error Handling:
    - Validates pitch range values (min/max must be valid numbers)
    - Ensures envelope times are positive values
    - Verifies curve values are within -100 to 100 range
    - Returns detailed error messages for invalid configurations
    
    Success Response:
    Returns XML structure containing:
    - Global controls for each drum type
    - MIDI CC mappings for real-time control
    - Properly formatted parameter bindings`,
            inputSchema: {
              type: "object",
              properties: {
                drumControls: {
                  type: "object",
                  additionalProperties: {
                    type: "object",
                    properties: {
                      pitch: {
                        type: "object",
                        properties: {
                          default: { 
                            type: "number",
                            description: "Default pitch in semitones (0 = no change)"
                          },
                          min: { 
                            type: "number",
                            description: "Minimum pitch adjustment (e.g. -12 semitones)"
                          },
                          max: { 
                            type: "number",
                            description: "Maximum pitch adjustment (e.g. +12 semitones)"
                          }
                        },
                        required: ["default"]
                      },
                      envelope: {
                        type: "object",
                        properties: {
                          attack: { 
                            type: "number",
                            description: "Attack time in seconds"
                          },
                          decay: { 
                            type: "number",
                            description: "Decay time in seconds"
                          },
                          sustain: { 
                            type: "number",
                            description: "Sustain level (0-1)"
                          },
                          release: { 
                            type: "number",
                            description: "Release time in seconds"
                          },
                          attackCurve: { 
                            type: "number",
                            description: "-100 to 100, Default: -100 (logarithmic)"
                          },
                          decayCurve: { 
                            type: "number",
                            description: "-100 to 100, Default: 100 (exponential)"
                          },
                          releaseCurve: { 
                            type: "number",
                            description: "-100 to 100, Default: 100 (exponential)"
                          }
                        },
                        required: ["attack", "decay", "sustain", "release"]
                      }
                    }
                  }
                }
              },
              required: ["drumControls"]
            }
          },
  • TypeScript interfaces defining the schema for DrumControlsConfig, DrumConfig, DrumPitchConfig, and DrumEnvelopeConfig used by the handler.
    export interface DrumPitchConfig {
      default: number;
      min?: number;
      max?: number;
    }
    
    export interface DrumEnvelopeConfig {
      attack: number;
      decay: number;
      sustain: number;
      release: number;
      attackCurve?: number;
      decayCurve?: number;
      releaseCurve?: number;
    }
    
    export interface DrumConfig {
      name: string;
      rootNote: number;  // Required instead of defaulting
      pitch?: DrumPitchConfig;
      envelope?: DrumEnvelopeConfig;
    }
    
    export interface DrumControlsConfig {
      drums: DrumConfig[];
    }
  • MCP CallToolRequestHandler case for 'configure_drum_controls' that validates input, converts format, calls the core handler, generates XML output, and handles errors.
    case "configure_drum_controls": {
      const args = request.params.arguments;
      if (!args || typeof args !== 'object' || !args.drumControls) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Invalid arguments: expected object with drumControls"
        );
      }
    
      try {
        // Convert the input format to our DrumControlsConfig format
        const drumControlsConfig: DrumControlsConfig = {
          drums: Object.entries(args.drumControls).map(([name, controls]) => ({
            name,
            ...(controls as any)
          }))
        };
    
        // Configure and validate the drum controls
        const config = configureDrumControls(drumControlsConfig);
    
        // Generate XML with the validated configuration
        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 drum controls: ${message}`
        );
      }
    }
  • Helper validation functions for pitch and envelope settings used by the configureDrumControls handler to ensure valid configurations.
    function validatePitchSettings(drum: DrumConfig): void {
      if (!drum.pitch) return;
    
      const { default: defaultPitch, min, max } = drum.pitch;
    
      // Validate min/max if provided
      if (min !== undefined && max !== undefined && min > max) {
        throw new Error(
          `Invalid pitch range for drum "${drum.name}": min (${min}) cannot be greater than max (${max})`
        );
      }
    
      // Validate default is within range
      if (min !== undefined && defaultPitch < min) {
        throw new Error(
          `Invalid default pitch for drum "${drum.name}": ${defaultPitch} is below minimum ${min}`
        );
      }
      if (max !== undefined && defaultPitch > max) {
        throw new Error(
          `Invalid default pitch for drum "${drum.name}": ${defaultPitch} is above maximum ${max}`
        );
      }
    }
    
    function validateEnvelopeSettings(drum: DrumConfig): void {
      if (!drum.envelope) return;
    
      const env = drum.envelope;
    
      // Validate time values are positive
      if (env.attack < 0) {
        throw new Error(
          `Invalid attack time for drum "${drum.name}": ${env.attack}. Must be >= 0`
        );
      }
      if (env.decay < 0) {
        throw new Error(
          `Invalid decay time for drum "${drum.name}": ${env.decay}. Must be >= 0`
        );
      }
      if (env.release < 0) {
        throw new Error(
          `Invalid release time for drum "${drum.name}": ${env.release}. Must be >= 0`
        );
      }
    
      // Validate sustain level is between 0 and 1
      if (env.sustain < 0 || env.sustain > 1) {
        throw new Error(
          `Invalid sustain level for drum "${drum.name}": ${env.sustain}. Must be between 0 and 1`
        );
      }
    
      // Validate curve values if provided
      const validateCurve = (value: number | undefined, name: string) => {
        if (value !== undefined && (value < -100 || value > 100)) {
          throw new Error(
            `Invalid ${name} curve for drum "${drum.name}": ${value}. Must be between -100 and 100`
          );
        }
      };
    
      validateCurve(env.attackCurve, 'attack');
      validateCurve(env.decayCurve, 'decay');
      validateCurve(env.releaseCurve, 'release');
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and does an excellent job disclosing behavioral traits. It clearly explains the tool generates XML structure, details comprehensive error handling with specific validation rules, and describes the success response format including MIDI CC mappings and parameter bindings.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, what the tool will do, error handling, success response) and appropriately sized. Every sentence adds value, though the bullet points could be slightly more concise. The information is front-loaded with the core purpose first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex configuration tool with no annotations and no output schema, the description provides substantial context about behavior, error handling, and response format. It covers what the tool does, how it validates inputs, and what it returns, though it could benefit from more parameter semantics and usage guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but only partially succeeds. While it mentions 'pitch controls with customizable ranges' and 'ADSR envelope settings', it doesn't explain the drumControls object structure or provide semantic context for the nested parameters. The description adds some value but doesn't fully compensate for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('configure global pitch and envelope controls') and resource ('for each drum type'), distinguishing it from sibling tools like analyze_wav_samples or generate_drum_groups. The first sentence provides a complete purpose statement with verb, resource, and scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, when this configuration should be applied, or how it relates to sibling tools like configure_mic_routing or configure_round_robin. The agent receives no usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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