Skip to main content
Glama
shukwong

gnomAD MCP Server

by shukwong

get_variant

Retrieve detailed genetic variant information from gnomAD databases to analyze population frequencies, constraint scores, and genomic data for research and clinical applications.

Instructions

Get detailed information about a specific variant

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variant_idYesVariant ID in format: chr-pos-ref-alt (e.g., 1-55516888-G-A)
datasetNoDataset ID (gnomad_r4, gnomad_r3, gnomad_r2_1, etc.)gnomad_r4

Implementation Reference

  • The core handler logic for the 'get_variant' tool within the CallToolRequestSchema handler. It invokes the GraphQL query using makeGraphQLRequest with the provided variant_id and parsed dataset_id.
    case "get_variant":
      result = await makeGraphQLRequest(QUERIES.getVariant, {
        variantId: args.variant_id as string,
        datasetId: parseDatasetId((args.dataset as string) || "gnomad_r4"),
      });
      formattedResult = result.data?.variant || null;
      break;
  • Input schema definition and registration for the 'get_variant' tool in the ListTools response.
    {
      name: "get_variant",
      description: "Get detailed information about a specific variant",
      inputSchema: {
        type: "object",
        properties: {
          variant_id: {
            type: "string",
            description: "Variant ID in format: chr-pos-ref-alt (e.g., 1-55516888-G-A)",
          },
          dataset: {
            type: "string",
            description: "Dataset ID (gnomad_r4, gnomad_r3, gnomad_r2_1, etc.)",
            default: "gnomad_r4",
          },
        },
        required: ["variant_id"],
      },
    },
  • GraphQL query schema (QUERIES.getVariant) that defines the structure and fields retrieved for the variant data.
    getVariant: `
      query GetVariant($variantId: String!, $datasetId: DatasetId!) {
        variant(variantId: $variantId, dataset: $datasetId) {
          variant_id
          reference_genome
          chrom
          pos
          ref
          alt
          rsids
          caid
          colocated_variants
          multi_nucleotide_variants {
            combined_variant_id
            changes_amino_acids
            n_individuals
            other_constituent_snvs
          }
          exome {
            ac
            an
            ac_hemi
            ac_hom
            faf95 {
              popmax
              popmax_population
            }
            filters
            populations {
              id
              ac
              an
              ac_hemi
              ac_hom
            }
          }
          genome {
            ac
            an
            ac_hemi
            ac_hom
            faf95 {
              popmax
              popmax_population
            }
            filters
            populations {
              id
              ac
              an
              ac_hemi
              ac_hom
            }
          }
          transcript_consequences {
            gene_id
            gene_symbol
            transcript_id
            consequence_terms
            is_canonical
            major_consequence
            polyphen_prediction
            sift_prediction
            lof
            lof_filter
            lof_flags
          }
        }
      }
    `,
  • Helper function makeGraphQLRequest used by the get_variant handler to execute the GraphQL query against the 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 parseDatasetId used to validate and default the dataset parameter in the get_variant 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 the full burden of behavioral disclosure. It mentions retrieving 'detailed information' but does not specify what that includes (e.g., annotations, frequencies, consequences), whether it's a read-only operation, potential errors (e.g., invalid ID), or performance aspects like rate limits. This leaves significant gaps in understanding the tool's behavior.

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, front-loaded sentence that directly states the tool's purpose without unnecessary words. It is efficiently structured, making it easy to parse and understand quickly, with no wasted 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 tool's complexity (fetching detailed variant data), lack of annotations, and no output schema, the description is insufficient. It does not explain what 'detailed information' entails, potential use cases, or how results are structured, leaving the agent with incomplete context for effective tool invocation.

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, clearly documenting both parameters (variant_id and dataset) with formats and defaults. The description adds no additional semantic context beyond implying the tool fetches details for a 'specific variant', which aligns with the schema but does not enhance parameter understanding. 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 'Get' and the resource 'detailed information about a specific variant', making the purpose immediately understandable. However, it does not explicitly differentiate this tool from sibling tools like 'get_variants_in_gene' or 'get_region_variants', which might also retrieve variant information but with different scopes or filters.

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 lacks context such as prerequisites (e.g., needing a specific variant ID format), exclusions (e.g., not for bulk queries), or comparisons to sibling tools like 'get_variants_in_gene' for gene-based queries or 'search' for broader searches.

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