get_protein_variants
Identifies disease-associated protein variants and mutations using a UniProt accession number, aiding in genetic research and analysis.
Instructions
Disease-associated variants and mutations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1261-1301 (handler)Core handler function that executes the tool: validates input, queries UniProt API for protein data, extracts and structures variant information (natural variants, mutagenesis, disease variants, polymorphisms), and returns formatted JSON.private async handleGetProteinVariants(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid protein variants arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); const protein = response.data; const variantInfo = { accession: protein.primaryAccession, naturalVariants: protein.features?.filter((f: any) => f.type === 'Natural variant') || [], mutagenesisFeatures: protein.features?.filter((f: any) => f.type === 'Mutagenesis') || [], diseaseVariants: protein.features?.filter((f: any) => f.type === 'Natural variant' && f.association?.disease ) || [], polymorphisms: protein.comments?.filter((c: any) => c.commentType === 'POLYMORPHISM') || [], }; return { content: [ { type: 'text', text: JSON.stringify(variantInfo, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein variants: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:536-544 (registration)Tool registration in ListToolsRequestSchema response, defining name, description, and input schema.name: 'get_protein_variants', description: 'Disease-associated variants and mutations', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], },
- src/index.ts:752-753 (registration)Dispatch case in CallToolRequestSchema handler that routes calls to the specific handler function.case 'get_protein_variants': return this.handleGetProteinVariants(args);
- src/index.ts:79-88 (schema)Type guard function for validating input arguments matching the tool's input schema (shared with similar tools). Used in the handler.const isValidProteinInfoArgs = ( args: any ): args is { accession: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.accession === 'string' && args.accession.length > 0 && (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format)) );