get_gene
Retrieve comprehensive gene details, including constraint scores, using Ensembl gene ID or gene symbol. Supports GRCh37 and GRCh38 reference genomes.
Instructions
Get detailed information about a gene including constraint scores
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gene_id | No | Ensembl gene ID (e.g., ENSG00000141510) | |
| gene_symbol | No | Gene symbol (e.g., TP53) | |
| reference_genome | No | Reference genome (GRCh37 or GRCh38) | GRCh38 |
Implementation Reference
- src/index.ts:656-666 (handler)The handler logic for the 'get_gene' tool within the CallToolRequestSchema switch statement. It validates that either gene_id or gene_symbol is provided, constructs the GraphQL variables, calls makeGraphQLRequest with the QUERIES.getGene template, and sets the formatted result from the gene data.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;
- src/index.ts:442-459 (schema)Input schema (JSON Schema) for the 'get_gene' tool, defining parameters: gene_id (optional), gene_symbol (optional, one required), reference_genome (optional, defaults to GRCh38). Used for validation in MCP.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:439-460 (registration)Registration of the 'get_gene' tool in the ListToolsRequestSchema response. Includes 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", }, }, }, },
- src/index.ts:74-115 (helper)GraphQL query template QUERIES.getGene used by the handler to fetch detailed gene information from gnomAD, including location, constraint metrics (pLI, oe_lof, etc.), 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 } } } `,
- src/index.ts:44-61 (helper)Helper function to perform GraphQL POST requests to the gnomAD API endpoint, handling fetch, error checking, and JSON parsing. Used by all tool handlers including get_gene.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; }