validate_gene_id
Verify and standardize gene identifiers (GENCODE ID or gene symbol) for accurate querying of GTEx genomics data across human tissues.
Instructions
Validate and normalize gene identifiers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geneId | Yes | Gene ID to validate (GENCODE ID or gene symbol) |
Implementation Reference
- Core handler function that validates a list of gene IDs by calling the GTEx API's getGenes method and categorizing them as valid or invalid based on returned data.private async validateGeneIds(geneIds: string[]) { const validGenes: string[] = []; const invalidGenes: string[] = []; // Try to get information for all gene IDs const result = await this.apiClient.getGenes(geneIds, 'v26', 'GRCh38/hg38'); if (!result.error && result.data) { const foundGenes = result.data.map(gene => gene.gencodeId || gene.geneSymbol); geneIds.forEach(id => { if (foundGenes.some(foundId => foundId.toLowerCase() === id.toLowerCase())) { validGenes.push(id); } else { invalidGenes.push(id); } }); } else { // If API call fails, mark all as invalid invalidGenes.push(...geneIds); } let output = `**Gene ID Validation Results**\n`; output += `Checked: ${geneIds.length} gene IDs\n\n`; if (validGenes.length > 0) { output += `**✅ Valid Gene IDs (${validGenes.length}):**\n`; validGenes.forEach(id => { output += ` • ${id}\n`; }); } if (invalidGenes.length > 0) { output += `\n**❌ Invalid Gene IDs (${invalidGenes.length}):**\n`; invalidGenes.forEach(id => { output += ` • ${id}\n`; }); output += `\n**Note:** Invalid IDs may be due to incorrect format, obsolete IDs, or typos.\n`; } return { content: [{ type: "text", text: output }] }; }
- Public handler method called by the router for validate_gene_id and validate_variant_id tools. Dispatches to specific validation based on type ('gene').*/ async validateIds(args: any) { if (!args.ids || !Array.isArray(args.ids) || args.ids.length === 0) { throw new Error('ids parameter is required and must be a non-empty array of IDs to validate'); } const idType = args.type || 'gene'; // 'gene' or 'variant' if (idType === 'gene') { return await this.validateGeneIds(args.ids); } else if (idType === 'variant') { return await this.validateVariantIds(args.ids); } else { throw new Error('type parameter must be either "gene" or "variant"'); } }
- src/index.ts:751-756 (registration)Tool call dispatcher in index.ts that routes 'validate_gene_id' requests to ReferenceHandlers.validateIds with gene-specific parameters.if (name === "validate_gene_id") { return await referenceHandlers.validateIds({ ids: [args?.geneId], type: 'gene' }); }
- src/index.ts:497-510 (schema)Tool schema definition provided in the ListTools response, including input schema requiring 'geneId'.{ name: "validate_gene_id", description: "Validate and normalize gene identifiers", inputSchema: { type: "object", properties: { geneId: { type: "string", description: "Gene ID to validate (GENCODE ID or gene symbol)" } }, required: ["geneId"] } },