Skip to main content
Glama
taehojo
by taehojo

compare_variants

Compare two genetic variants to determine their regulatory impacts, expression changes, splicing alterations, and relative severity for variant analysis.

Instructions

Compare two variants side-by-side.

Direct comparison of regulatory impacts between two variants.

Returns:

  • Impact levels for both variants

  • Expression and splicing changes

  • Which variant is more severe

Perfect for: comparing candidate variants, understanding relative severity.

Example: "Compare rs429358 vs rs7412"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variant1Yes
variant2Yes

Implementation Reference

  • Core handler function that executes the compare_variants tool logic by predicting effects for two variants using predict_variant_effect and comparing their impacts.
    def compare_variants(client, params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Compare two variants side-by-side.
        """
        variant1 = params.get('variant1')
        variant2 = params.get('variant2')
    
        result1 = predict_variant_effect(client, variant1)
        result2 = predict_variant_effect(client, variant2)
    
        return {
            'variant1': {
                'id': result1['variant'],
                'impact': result1['interpretation']['impact_level'],
                'expression_fc': result1['predictions'].get('rna_seq', {}).get('fold_change', 0),
                'splice_delta': result1['predictions'].get('splice', {}).get('delta', 0)
            },
            'variant2': {
                'id': result2['variant'],
                'impact': result2['interpretation']['impact_level'],
                'expression_fc': result2['predictions'].get('rna_seq', {}).get('fold_change', 0),
                'splice_delta': result2['predictions'].get('splice', {}).get('delta', 0)
            },
            'comparison': {
                'more_severe': result1['variant'] if abs(result1['predictions'].get('rna_seq', {}).get('fold_change', 0)) > abs(result2['predictions'].get('rna_seq', {}).get('fold_change', 0)) else result2['variant']
            }
        }
  • Input schema and metadata definition for the compare_variants tool, specifying structure for variant1 and variant2 inputs.
    export const COMPARE_VARIANTS_TOOL: Tool = {
      name: 'compare_variants',
      description: `Compare two variants side-by-side.
    
    Direct comparison of regulatory impacts between two variants.
    
    Returns:
    - Impact levels for both variants
    - Expression and splicing changes
    - Which variant is more severe
    
    Perfect for: comparing candidate variants, understanding relative severity.
    
    Example: "Compare rs429358 vs rs7412"`,
      inputSchema: {
        type: 'object',
        properties: {
          variant1: {
            type: 'object',
            properties: {
              chromosome: { type: 'string', pattern: '^chr([1-9]|1[0-9]|2[0-2]|X|Y)$' },
              position: { type: 'number', minimum: 1 },
              ref: { type: 'string', pattern: '^[ATGCatgc]+$' },
              alt: { type: 'string', pattern: '^[ATGCatgc]+$' },
            },
            required: ['chromosome', 'position', 'ref', 'alt'],
          },
          variant2: {
            type: 'object',
            properties: {
              chromosome: { type: 'string', pattern: '^chr([1-9]|1[0-9]|2[0-2]|X|Y)$' },
              position: { type: 'number', minimum: 1 },
              ref: { type: 'string', pattern: '^[ATGCatgc]+$' },
              alt: { type: 'string', pattern: '^[ATGCatgc]+$' },
            },
            required: ['chromosome', 'position', 'ref', 'alt'],
          },
        },
        required: ['variant1', 'variant2'],
      },
    };
  • src/tools.ts:709-730 (registration)
    Registration of the compare_variants tool (COMPARE_VARIANTS_TOOL) in the ALL_TOOLS array, which is served via the MCP listTools endpoint.
    export const ALL_TOOLS: Tool[] = [
      PREDICT_VARIANT_TOOL,
      BATCH_SCORE_TOOL,
      ASSESS_PATHOGENICITY_TOOL,
      PREDICT_TISSUE_SPECIFIC_TOOL,
      COMPARE_VARIANTS_TOOL,
      PREDICT_SPLICE_IMPACT_TOOL,
      PREDICT_EXPRESSION_IMPACT_TOOL,
      ANALYZE_GWAS_LOCUS_TOOL,
      COMPARE_ALLELES_TOOL,
      BATCH_TISSUE_COMPARISON_TOOL,
      PREDICT_TF_BINDING_IMPACT_TOOL,
      PREDICT_CHROMATIN_IMPACT_TOOL,
      COMPARE_PROTECTIVE_RISK_TOOL,
      BATCH_PATHOGENICITY_FILTER_TOOL,
      COMPARE_VARIANTS_SAME_GENE_TOOL,
      PREDICT_ALLELE_SPECIFIC_EFFECTS_TOOL,
      ANNOTATE_REGULATORY_CONTEXT_TOOL,
      BATCH_MODALITY_SCREEN_TOOL,
      GENERATE_VARIANT_REPORT_TOOL,
      EXPLAIN_VARIANT_IMPACT_TOOL,
    ];
  • MCP server handler that dispatches compare_variants tool calls to the AlphaGenomeClient.
    case 'compare_variants': {
      const result = await getClient().compareVariants(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Client proxy method that invokes the Python bridge for compare_variants action.
    async compareVariants(params: any): Promise<any> {
      try {
        return await this.callPythonBridge('compare_variants', params);
      } catch (error) {
        if (error instanceof ApiError) throw error;
        throw new ApiError(`Variant comparison failed: ${error}`, 500);
      }
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior by specifying what it returns (impact levels, expression/splicing changes, severity comparison) and includes an example. However, it doesn't mention computational requirements, rate limits, error conditions, or whether this is a read-only vs. mutation operation. The behavioral disclosure is adequate but incomplete for a tool with zero annotation coverage.

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 efficiently structured with clear sections: purpose statement, what it returns, usage context, and example. Every sentence adds value with zero waste. The front-loaded purpose statement immediately communicates the tool's function, followed by supporting details in a logical flow.

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

Completeness3/5

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

Given the tool's complexity (2 nested parameters, no output schema, no annotations), the description provides adequate purpose and usage context but lacks critical parameter semantics. The absence of output schema means the description should ideally explain return values more thoroughly, though it does list what's returned. For a comparison tool with complex genetic variant inputs, the description is minimally complete but has clear gaps.

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

Parameters2/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. While it mentions comparing 'two variants', it provides no semantic details about the variant1/variant2 parameters beyond their existence. The description doesn't explain what constitutes a variant, the required format, or the meaning of chromosome/position/ref/alt fields. With 2 complex nested parameters completely undocumented in schema descriptions, this represents a significant gap.

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 tool's purpose: 'Compare two variants side-by-side' with specific focus on 'regulatory impacts between two variants'. It distinguishes from siblings like 'compare_variants_same_gene' by not limiting to same-gene comparisons and from 'compare_alleles' by focusing on regulatory impacts rather than general allele comparison. The verb 'compare' and resource 'variants' are specific and well-defined.

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

Usage Guidelines4/5

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

The description provides clear usage context with 'Perfect for: comparing candidate variants, understanding relative severity' and includes an example. However, it doesn't explicitly state when NOT to use this tool versus alternatives like 'compare_variants_same_gene' or 'assess_pathogenicity', nor does it mention prerequisites or dependencies. The guidance is helpful but lacks explicit exclusions or alternative recommendations.

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/taehojo/alphagenome-mcp'

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