get_protein_features
Retrieve functional features and domains for a protein using its UniProt accession number to analyze protein structure and biological roles.
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)The handler function for 'get_protein_features' tool. Fetches protein data from UniProt API and extracts specific features like 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:737-737 (registration)Tool dispatch/registration in the CallToolRequestSchema switch statement.return this.handleGetProteinFeatures(args);
- src/index.ts:452-460 (schema)Tool schema and metadata registration in the ListToolsRequestSchema response.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 (helper)Validation helper function used by get_protein_features to validate input arguments.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)) ); };