validate_variant_id
Validate variant identifiers and genomic coordinates to ensure accurate genetic data analysis in the GTEx Portal.
Instructions
Validate variant identifiers and genomic coordinates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variantId | No | Variant ID to validate (rs number or variant ID) | |
| chr | No | Chromosome (alternative validation method) | |
| position | No | Genomic position (alternative validation method) |
Implementation Reference
- Core handler function that executes the validation logic for variant IDs by querying the GTEx API getVariants endpoint for each ID and categorizing valid vs invalid based on whether data is returned.private async validateVariantIds(variantIds: string[]) { const validVariants: string[] = []; const invalidVariants: string[] = []; // Check each variant ID individually for (const variantId of variantIds) { const result = await this.apiClient.getVariants({ variantId: variantId, datasetId: 'gtex_v8', page: 0, itemsPerPage: 1 }); if (!result.error && result.data && result.data.length > 0) { validVariants.push(variantId); } else { invalidVariants.push(variantId); } } let output = `**Variant ID Validation Results**\n`; output += `Checked: ${variantIds.length} variant IDs\n\n`; if (validVariants.length > 0) { output += `**✅ Valid Variant IDs (${validVariants.length}):**\n`; validVariants.forEach(id => { output += ` • ${id}\n`; }); } if (invalidVariants.length > 0) { output += `\n**❌ Invalid Variant IDs (${invalidVariants.length}):**\n`; invalidVariants.forEach(id => { output += ` • ${id}\n`; }); output += `\n**Note:** Invalid IDs may be due to incorrect format or variants not present in the GTEx dataset.\n`; } return { content: [{ type: "text", text: output }] }; }
- src/index.ts:757-762 (registration)Registration and dispatch logic in the main CallToolRequestHandler that routes "validate_variant_id" tool invocations to the ReferenceHandlers.validateIds method with type 'variant'.if (name === "validate_variant_id") { return await referenceHandlers.validateIds({ ids: [args?.variantId], type: 'variant' }); }
- src/index.ts:512-530 (schema)Tool schema definition including name, description, and input schema provided in the ListTools response.name: "validate_variant_id", description: "Validate variant identifiers and genomic coordinates", inputSchema: { type: "object", properties: { variantId: { type: "string", description: "Variant ID to validate (rs number or variant ID)" }, chr: { type: "string", description: "Chromosome (alternative validation method)" }, position: { type: "integer", description: "Genomic position (alternative validation method)" } } }
- Entry-point handler method called by the main server dispatcher; routes to variant-specific validation based on type parameter.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"'); } }