Skip to main content
Glama
shukwong

gnomAD MCP Server

by shukwong

get_gene

Retrieve detailed gene information including constraint scores from gnomAD database to analyze genetic variants and population frequencies.

Instructions

Get detailed information about a gene including constraint scores

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idNoEnsembl gene ID (e.g., ENSG00000141510)
gene_symbolNoGene symbol (e.g., TP53)
reference_genomeNoReference genome (GRCh37 or GRCh38)GRCh38

Implementation Reference

  • The handler logic for the 'get_gene' tool within the CallToolRequestSchema handler. It validates that either gene_id or gene_symbol is provided, then executes a GraphQL request using the predefined getGene query and parses the reference genome.
    case "get_gene":
      if (!args.gene_id && !args.gene_symbol) {
        throw new Error("Either gene_id or gene_symbol must be provided");
      }
      result = await makeGraphQLRequest(QUERIES.getGene, {
        geneId: (args.gene_id as string) || null,
        geneSymbol: (args.gene_symbol as string) || null,
        referenceGenome: parseReferenceGenome((args.reference_genome as string) || "GRCh38"),
      });
      formattedResult = result.data?.gene || null;
      break;
  • Input schema for the 'get_gene' tool, defining the expected parameters: gene_id (optional), gene_symbol (optional), and reference_genome (optional with default).
    inputSchema: {
      type: "object",
      properties: {
        gene_id: {
          type: "string",
          description: "Ensembl gene ID (e.g., ENSG00000141510)",
        },
        gene_symbol: {
          type: "string",
          description: "Gene symbol (e.g., TP53)",
        },
        reference_genome: {
          type: "string",
          description: "Reference genome (GRCh37 or GRCh38)",
          default: "GRCh38",
        },
      },
    },
  • src/index.ts:440-460 (registration)
    Registration of the 'get_gene' tool in the ListToolsRequestSchema response, including name, description, and input schema.
      name: "get_gene",
      description: "Get detailed information about a gene including constraint scores",
      inputSchema: {
        type: "object",
        properties: {
          gene_id: {
            type: "string",
            description: "Ensembl gene ID (e.g., ENSG00000141510)",
          },
          gene_symbol: {
            type: "string",
            description: "Gene symbol (e.g., TP53)",
          },
          reference_genome: {
            type: "string",
            description: "Reference genome (GRCh37 or GRCh38)",
            default: "GRCh38",
          },
        },
      },
    },
  • GraphQL query template (QUERIES.getGene) used by the get_gene handler to fetch detailed gene information including constraint metrics and transcripts.
    getGene: `
      query GetGene($geneId: String, $geneSymbol: String, $referenceGenome: ReferenceGenomeId!) {
        gene(gene_id: $geneId, gene_symbol: $geneSymbol, reference_genome: $referenceGenome) {
          gene_id
          symbol
          name
          canonical_transcript_id
          hgnc_id
          omim_id
          chrom
          start
          stop
          strand
          gnomad_constraint {
            exp_lof
            exp_mis
            exp_syn
            obs_lof
            obs_mis
            obs_syn
            oe_lof
            oe_lof_lower
            oe_lof_upper
            oe_mis
            oe_mis_lower
            oe_mis_upper
            oe_syn
            oe_syn_lower
            oe_syn_upper
            lof_z
            mis_z
            syn_z
            pLI
          }
          transcripts {
            transcript_id
            transcript_version
            reference_genome
          }
        }
      }
    `,
  • Helper function to make GraphQL requests to the gnomAD API, used by the get_gene handler.
    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;
    }

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