Skip to main content
Glama
taehojo
by taehojo

compare_variants_same_gene

Compare and rank multiple genetic variants within a single gene to analyze their relative impact and identify compound heterozygotes for gene-level analysis.

Instructions

Compare multiple variants within the same gene.

Ranks variants by impact within a single gene context.

Perfect for: gene-level analysis, compound heterozygote analysis.

Example: "Compare 5 BRCA1 variants"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variantsYes
gene_nameNoOptional: gene name for context

Implementation Reference

  • Core handler function that executes the tool logic: processes list of variants, predicts effects using AlphaGenome API via predict_variant_effect helper, ranks by absolute expression fold change, returns ranked results with gene context.
    def compare_variants_same_gene(client, params: Dict[str, Any]) -> Dict[str, Any]:
        """Compare multiple variants in the same gene."""
        variants_data = params.get('variants', [])
        gene = params.get('gene', 'unknown')
    
        results = []
        for v in variants_data:
            try:
                result = predict_variant_effect(client, v)
                results.append({
                    'variant': result['variant'],
                    'impact': result['interpretation']['impact_level'],
                    'expression_fc': result['predictions'].get('rna_seq', {}).get('fold_change', 0),
                    'clinical_sig': result['interpretation']['clinical_significance']
                })
            except Exception as e:
                print(f"Warning: Failed: {e}", file=sys.stderr)
                continue
    
        results.sort(key=lambda x: abs(x['expression_fc']), reverse=True)
        return {
            'gene': gene,
            'total_variants': len(results),
            'ranked_variants': results
        }
  • MCP server request handler case for the tool: validates (implicitly), calls client proxy, formats result as JSON text content.
    case 'compare_variants_same_gene': {
      const result = await getClient().compareVariantsSameGene(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Input schema definition for the tool: requires array of at least 2 variants (each with chr, pos, ref, alt), optional gene_name.
    export const COMPARE_VARIANTS_SAME_GENE_TOOL: Tool = {
      name: 'compare_variants_same_gene',
      description: `Compare multiple variants within the same gene.
    
    Ranks variants by impact within a single gene context.
    
    Perfect for: gene-level analysis, compound heterozygote analysis.
    
    Example: "Compare 5 BRCA1 variants"`,
      inputSchema: {
        type: 'object',
        properties: {
          variants: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                chromosome: { type: 'string' },
                position: { type: 'number' },
                ref: { type: 'string' },
                alt: { type: 'string' },
              },
              required: ['chromosome', 'position', 'ref', 'alt'],
            },
            minItems: 2,
          },
          gene_name: {
            type: 'string',
            description: 'Optional: gene name for context',
          },
        },
        required: ['variants'],
      },
    };
  • src/index.ts:235-240 (registration)
    Tool dispatch registration in MCP CallToolRequestSchema handler switch statement.
    case 'compare_variants_same_gene': {
      const result = await getClient().compareVariantsSameGene(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • src/tools.ts:724-724 (registration)
    Tool registration in ALL_TOOLS export array used by ListToolsRequestSchema handler.
    COMPARE_VARIANTS_SAME_GENE_TOOL,
  • Client proxy method that spawns Python bridge subprocess with action='compare_variants_same_gene' and params, handles errors.
    async compareVariantsSameGene(params: any): Promise<any> {
      try {
        return await this.callPythonBridge('compare_variants_same_gene', params);
      } catch (error) {
        if (error instanceof ApiError) throw error;
        throw new ApiError(`Same-gene variant comparison failed: ${error}`, 500);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions ranking by impact but doesn't disclose what criteria are used for ranking, whether this requires specific data sources, what the output format looks like, or any limitations. For a comparison/ranking tool with no annotation coverage, this leaves significant behavioral gaps.

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 efficiently structured with a clear purpose statement, usage context, and example. All sentences add value, though the example could be more informative. It's appropriately sized for the tool's complexity.

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?

For a comparison tool with no annotations and no output schema, the description provides adequate basic context about purpose and usage but lacks details about behavioral traits, ranking methodology, and output format. Given the 2 parameters with partial schema coverage, the description is minimally complete but leaves important gaps.

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 50% (only gene_name has a description). The description doesn't add any parameter-specific information beyond what's implied by the tool name. It doesn't explain the expected format of variants, what chromosome values are valid, or clarify that gene_name is optional despite being described as 'for context.' Baseline 3 is appropriate given the schema does some work but gaps remain.

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 tool's purpose: 'Compare multiple variants within the same gene' and 'Ranks variants by impact within a single gene context.' It specifies the verb (compare/rank) and resource (variants within a gene), but doesn't explicitly differentiate from the sibling tool 'compare_variants' which appears to be a more general comparison tool.

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 context for when to use this tool: 'Perfect for: gene-level analysis, compound heterozygote analysis' and includes an example. However, it doesn't explicitly state when NOT to use it or mention alternatives like the sibling 'compare_variants' tool for cross-gene comparisons.

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