Skip to main content
Glama
shukwong

gnomAD MCP Server

by shukwong

get_region_variants

Retrieve genetic variants from gnomAD database for a specified genomic region using chromosome, start, and stop positions to analyze population genetics data.

Instructions

Get variants in a specific genomic region

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chromYesChromosome (1-22, X, Y)
startYesStart position
stopYesStop position
datasetNoDataset IDgnomad_r4
reference_genomeNoReference genomeGRCh38

Implementation Reference

  • Handler logic for the get_region_variants tool: parses arguments, calls GraphQL query via makeGraphQLRequest, and returns the variants array as JSON.
    case "get_region_variants":
      result = await makeGraphQLRequest(QUERIES.getRegionVariants, {
        chrom: String(args.chrom),
        start: parseInt(String(args.start)),
        stop: parseInt(String(args.stop)),
        datasetId: parseDatasetId((args.dataset as string) || "gnomad_r4"),
        referenceGenome: parseReferenceGenome((args.reference_genome as string) || "GRCh38"),
      });
      formattedResult = result.data?.region?.variants || [];
      break;
  • GraphQL query schema defining the structure and inputs for fetching region variants from gnomAD API.
    getRegionVariants: `
      query GetRegionVariants($chrom: String!, $start: Int!, $stop: Int!, $datasetId: DatasetId!, $referenceGenome: ReferenceGenomeId!) {
        region(chrom: $chrom, start: $start, stop: $stop, reference_genome: $referenceGenome) {
          variants(dataset: $datasetId) {
            variant_id
            pos
            rsids
            consequence
            hgvsc
            hgvsp
            lof
            exome {
              ac
              an
              af
              filters
            }
            genome {
              ac
              an
              af
              filters
            }
          }
        }
      }
    `,
  • src/index.ts:526-557 (registration)
    MCP tool registration including name, description, and input schema for get_region_variants.
    {
      name: "get_region_variants",
      description: "Get variants in a specific genomic region",
      inputSchema: {
        type: "object",
        properties: {
          chrom: {
            type: "string",
            description: "Chromosome (1-22, X, Y)",
          },
          start: {
            type: "number",
            description: "Start position",
          },
          stop: {
            type: "number",
            description: "Stop position",
          },
          dataset: {
            type: "string",
            description: "Dataset ID",
            default: "gnomad_r4",
          },
          reference_genome: {
            type: "string",
            description: "Reference genome",
            default: "GRCh38",
          },
        },
        required: ["chrom", "start", "stop"],
      },
    },
  • Helper function used by all tool handlers, including get_region_variants, to execute GraphQL requests to gnomAD API.
    async function makeGraphQLRequest(query: string, variables: Record<string, any> = {}): Promise<GnomadResponse> {
      const response: Response = await fetch(GNOMAD_API_URL, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          query,
          variables,
        }),
      });
    
      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }
    
      return await response.json() as GnomadResponse;
    }
  • Helper function to validate and parse the dataset ID used in the get_region_variants handler.
    function parseDatasetId(dataset: string): string {
      const validDatasets = [
        "gnomad_r2_1",
        "gnomad_r3",
        "gnomad_r4",
        "gnomad_sv_r2_1",
        "gnomad_sv_r4",
        "gnomad_cnv_r4",
        "exac",
      ];
      
      const datasetLower = dataset.toLowerCase();
      if (!validDatasets.includes(datasetLower)) {
        return "gnomad_r4"; // Default to latest version
      }
      return datasetLower;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about return format (list of variants? structured data?), pagination, rate limits, authentication requirements, or error conditions. For a query tool with 5 parameters, 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.

Conciseness5/5

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

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a tool with clear parameters documented in the schema, and the information is front-loaded effectively.

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?

For a genomic query tool with 5 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'variants' means in this context, what data is returned, or how results are structured. The agent would need to guess about the tool's behavior and output format based solely on the parameter schema.

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%, so the schema already documents all 5 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema - it doesn't explain relationships between parameters (e.g., that start/stop define the region boundaries) or provide additional context about parameter usage.

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 ('Get') and resource ('variants in a specific genomic region'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'get_variants_in_gene' or 'get_variant', which could cause confusion about when to use each specific variant-fetching tool.

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 like 'get_variants_in_gene' or 'get_variant'. It doesn't specify whether this is for region-based queries versus gene-based queries, nor does it mention any prerequisites or exclusions for usage.

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/shukwong/gnomad-mcp-server'

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