Skip to main content
Glama
williamzujkowski

Strudel MCP Server

compare_patterns

Compare two music patterns to identify differences in their structure and composition for analysis and refinement.

Instructions

Compare two patterns from history showing differences

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
id1YesFirst pattern ID
id2NoSecond pattern ID (default: current pattern)

Implementation Reference

  • Handler function for compare_patterns tool in executeTool switch statement. Finds patterns from history by ID, gets current or second pattern, generates diff and summary using helper methods.
    case 'compare_patterns':
      const entry1 = this.historyStack.find(e => e.id === args.id1);
      if (!entry1) {
        return `History entry #${args.id1} not found.`;
      }
    
      let pattern2: string;
      let label2: string;
    
      if (args.id2) {
        const entry2 = this.historyStack.find(e => e.id === args.id2);
        if (!entry2) {
          return `History entry #${args.id2} not found.`;
        }
        pattern2 = entry2.pattern;
        label2 = `#${args.id2}`;
      } else {
        pattern2 = await this.getCurrentPatternSafe();
        label2 = 'current';
      }
    
      const diff = this.generateDiff(entry1.pattern, pattern2);
      return {
        pattern1: { id: args.id1, chars: entry1.pattern.length },
        pattern2: { id: label2, chars: pattern2.length },
        diff: diff,
        summary: this.summarizeDiff(entry1.pattern, pattern2)
      };
  • Tool registration in getTools() method, including name, description, and input schema.
    {
      name: 'compare_patterns',
      description: 'Compare two patterns from history showing differences',
      inputSchema: {
        type: 'object',
        properties: {
          id1: { type: 'number', description: 'First pattern ID' },
          id2: { type: 'number', description: 'Second pattern ID (default: current pattern)' }
        },
        required: ['id1']
      }
    },
  • Helper method to generate line-by-line diff between two patterns, used by compare_patterns handler.
    private generateDiff(pattern1: string, pattern2: string): string[] {
      const lines1 = pattern1.split('\n');
      const lines2 = pattern2.split('\n');
      const diff: string[] = [];
    
      const maxLines = Math.max(lines1.length, lines2.length);
    
      for (let i = 0; i < maxLines; i++) {
        const line1 = lines1[i] || '';
        const line2 = lines2[i] || '';
    
        if (line1 === line2) {
          diff.push(`  ${line1}`);
        } else {
          if (line1) diff.push(`- ${line1}`);
          if (line2) diff.push(`+ ${line2}`);
        }
      }
    
      return diff;
    }
  • Helper method to summarize differences (lines added/removed/changed, char diff) between two patterns, used by compare_patterns handler.
    private summarizeDiff(pattern1: string, pattern2: string): {
      linesAdded: number;
      linesRemoved: number;
      linesChanged: number;
      charsDiff: number;
    } {
      const lines1 = pattern1.split('\n');
      const lines2 = pattern2.split('\n');
    
      let linesAdded = 0;
      let linesRemoved = 0;
      let linesChanged = 0;
    
      const maxLines = Math.max(lines1.length, lines2.length);
    
      for (let i = 0; i < maxLines; i++) {
        const line1 = lines1[i];
        const line2 = lines2[i];
    
        if (line1 === undefined && line2 !== undefined) {
          linesAdded++;
        } else if (line1 !== undefined && line2 === undefined) {
          linesRemoved++;
        } else if (line1 !== line2) {
          linesChanged++;
        }
      }
    
      return {
        linesAdded,
        linesRemoved,
        linesChanged,
        charsDiff: pattern2.length - pattern1.length
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool compares patterns and shows differences, but doesn't explain what 'differences' entail (e.g., structural, timing, or content changes), whether it's read-only or modifies data, or any performance implications. This is a significant gap for a tool with potential complexity.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action ('compare') and resource ('two patterns'), making it easy to parse. Every part of the sentence contributes essential information.

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

Completeness2/5

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

Given the complexity of comparing patterns and the lack of annotations and output schema, the description is incomplete. It doesn't explain the nature of the comparison, output format, or any behavioral traits like error handling. For a tool that likely returns detailed differences, more context is needed to guide the agent effectively.

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 100%, with clear descriptions for 'id1' and 'id2' in the input schema. The description adds no additional parameter semantics beyond what the schema provides, such as explaining what a 'pattern ID' represents or how 'current pattern' is determined. This meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the verb 'compare' and the resource 'two patterns from history', specifying the action and target. It distinguishes itself from sibling tools like 'get_pattern' or 'list_history' by focusing on comparison rather than retrieval or listing. However, it doesn't explicitly differentiate from tools like 'analyze' or 'validate_pattern_runtime', which might also involve pattern examination, making it slightly less specific.

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. It doesn't mention prerequisites, such as needing existing patterns in history, or suggest when to choose this over similar tools like 'analyze' or 'validate_pattern_runtime'. The lack of context leaves the agent without clear usage instructions.

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

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