get_protein_features
Retrieve functional features and domains for a protein using its UniProt accession number. Identify key characteristics to understand protein structure and function.
Instructions
Get functional features and domains for a protein
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:946-988 (handler)Handler function that retrieves protein data from UniProt API and extracts specific features such as domains, active sites, binding sites, comments, and keywords.private async handleGetProteinFeatures(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid protein features arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); // Extract features and domains from the response const protein = response.data; const features = { accession: protein.primaryAccession, name: protein.uniProtkbId, features: protein.features || [], comments: protein.comments || [], keywords: protein.keywords || [], domains: protein.features?.filter((f: any) => f.type === 'Domain') || [], activeSites: protein.features?.filter((f: any) => f.type === 'Active site') || [], bindingSites: protein.features?.filter((f: any) => f.type === 'Binding site') || [], }; return { content: [ { type: 'text', text: JSON.stringify(features, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein features: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:452-460 (schema)Input schema defining the required 'accession' parameter for the tool.name: 'get_protein_features', description: 'Get functional features and domains for a protein', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], },
- src/index.ts:737-737 (registration)Registration in the tool dispatcher switch statement that routes calls to the handler.return this.handleGetProteinFeatures(args);
- src/index.ts:452-461 (registration)Tool registration in the ListToolsRequestSchema response, including name, description, and schema.name: 'get_protein_features', description: 'Get functional features and domains for a protein', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], }, },
- src/index.ts:79-89 (schema)Type guard function used for input validation in the handler, checking accession and optional format.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)) ); };