Skip to main content
Glama

get_variants

Retrieve genetic variants within a specified genomic region from GTEx datasets to support genetic research and analysis.

Instructions

Get genetic variants in a genomic region

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chrYesChromosome (e.g., chr1, chr2, chrX)
startYesStart position (1-based)
endYesEnd position (1-based)
datasetIdNoGTEx dataset ID (default: gtex_v8)gtex_v8

Implementation Reference

  • src/index.ts:420-446 (registration)
    Tool registration in the ListTools handler, defining name, description, and input schema for get_variants
    {
      name: "get_variants",
      description: "Get genetic variants in a genomic region",
      inputSchema: {
        type: "object",
        properties: {
          chr: {
            type: "string",
            description: "Chromosome (e.g., chr1, chr2, chrX)"
          },
          start: {
            type: "integer",
            description: "Start position (1-based)"
          },
          end: {
            type: "integer",
            description: "End position (1-based)"
          },
          datasetId: {
            type: "string",
            description: "GTEx dataset ID (default: gtex_v8)",
            default: "gtex_v8"
          }
        },
        required: ["chr", "start", "end"]
      }
    },
  • Main handler function executing the get_variants tool logic: input validation, API call to retrieve variants, and formatted text response generation.
    async getVariants(args: any) {
      if (!args.snpId && !args.variantId && !args.chromosome) {
        throw new Error('At least one of snpId, variantId, or chromosome must be provided');
      }
    
      const result = await this.apiClient.getVariants({
        snpId: args.snpId,
        variantId: args.variantId,
        datasetId: args.datasetId || 'gtex_v8',
        chromosome: args.chromosome,
        pos: args.positions ? (Array.isArray(args.positions) ? args.positions : [args.positions]) : undefined,
        page: args.page || 0,
        itemsPerPage: args.itemsPerPage || 250
      });
    
      if (result.error) {
        return {
          content: [{
            type: "text",
            text: `Error retrieving variant information: ${result.error}`
          }],
          isError: true
        };
      }
    
      const variants = result.data || [];
      if (variants.length === 0) {
        return {
          content: [{
            type: "text",
            text: "No variants found matching the specified criteria."
          }]
        };
      }
    
      let output = `**Variant Information (${variants.length} variants)**\n`;
      output += `Dataset: ${variants[0]?.datasetId}\n\n`;
    
      variants.forEach((variant, index) => {
        output += `### ${index + 1}. ${variant.variantId}\n`;
        output += `**Genomic Information:**\n`;
        output += `  • Position: ${variant.chromosome}:${variant.pos.toLocaleString()}\n`;
        output += `  • Alleles: ${variant.ref} → ${variant.alt}\n`;
        if (variant.snpId && variant.snpId !== 'nan') {
          output += `  • dbSNP ID: ${variant.snpId}\n`;
        }
        if (variant.b37VariantId) {
          output += `  • GRCh37 ID: ${variant.b37VariantId}\n`;
        }
        
        output += `\n**Population Genetics:**\n`;
        output += `  • MAF ≥1%: ${variant.maf01 ? 'Yes' : 'No'}\n`;
        
        if (variant.shorthand) {
          output += `  • Shorthand: ${variant.shorthand}\n`;
        }
        output += '\n';
      });
    
      if (result.paging_info && result.paging_info.totalNumberOfItems > variants.length) {
        output += `**Note:** Showing ${variants.length} of ${result.paging_info.totalNumberOfItems} total results.\n`;
      }
    
      return {
        content: [{
          type: "text",
          text: output.trim()
        }]
      };
    }
  • API client helper method that performs the HTTP request to GTEx Portal API endpoint /dataset/variant to fetch variant data.
    async getVariants(params: GetVariantsParams): Promise<GTExApiResponse<Variant[]>> {
      try {
        const queryParams = this.buildQueryParams({
          snpId: params.snpId,
          variantId: params.variantId,
          datasetId: params.datasetId || 'gtex_v8',
          chromosome: params.chromosome,
          pos: params.pos,
          page: params.page || 0,
          itemsPerPage: params.itemsPerPage || 250
        });
        const response = await this.axiosInstance.get(`/dataset/variant?${queryParams}`);
        return { 
          data: response.data.data,
          paging_info: response.data.paging_info
        };
      } catch (error) {
        return error as GTExApiResponse<Variant[]>;
      }
    }
  • TypeScript interface defining parameters for the getVariants API call used by the handler and client.
    export interface GetVariantsParams {
      snpId?: string;
      variantId?: string;
      datasetId?: string;
      chromosome?: string;
      pos?: number[];
      page?: number;
      itemsPerPage?: number;
    }
  • TypeScript interface defining the structure of variant data returned by the API.
    export interface Variant {
      snpId: string;
      b37VariantId: string;
      pos: number;
      maf01: boolean;
      variantId: string;
      alt: string;
      chromosome: string;
      snpIdUpper: string;
      datasetId: string;
      ref: string;
      shorthand: string;
    }
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 action ('Get') but doesn't describe any behavioral traits like whether this is a read-only operation, potential rate limits, authentication needs, or what the return format looks like (e.g., list of variants, JSON structure). This leaves significant gaps for an AI agent to understand how to handle the tool effectively.

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 any unnecessary words or fluff. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 genetic data tools and the lack of annotations and output schema, the description is insufficient. It doesn't explain what 'genetic variants' entail (e.g., SNPs, indels), how results are returned, or any limitations (e.g., region size constraints). For a tool with 4 parameters and no structured output information, more context is needed to be complete.

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?

The input schema has 100% description coverage, providing clear details for all parameters (chr, start, end, datasetId). The description adds no additional meaning beyond what's in the schema, such as explaining the relationship between parameters or usage nuances. According to the rules, with high schema coverage, the baseline is 3, which is appropriate here.

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 with a specific verb ('Get') and resource ('genetic variants in a genomic region'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_single_tissue_eqtls' or 'validate_variant_id', which might also involve genetic variants, so it doesn't reach the highest score.

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. With many sibling tools related to genetics and variants, such as 'get_single_tissue_eqtls' or 'validate_variant_id', there's no indication of context, exclusions, or prerequisites for selecting this tool over others.

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/Augmented-Nature/GTEx-MCP-Server'

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