get_protein_info
Retrieve detailed protein information from UniProt using accession numbers. Supports multiple output formats including JSON, TSV, FASTA, and XML for scientific analysis and data integration.
Instructions
Get detailed information for a specific protein by UniProt accession
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number (e.g., P04637) | |
| format | No | Output format (default: json) |
Implementation Reference
- src/index.ts:415-424 (registration)Registration of the 'get_protein_info' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.name: 'get_protein_info', description: 'Get detailed information for a specific protein by UniProt accession', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number (e.g., P04637)' }, format: { type: 'string', enum: ['json', 'tsv', 'fasta', 'xml'], description: 'Output format (default: json)' }, }, required: ['accession'], },
- src/index.ts:837-870 (handler)The handler function for 'get_protein_info' tool that validates input, queries the UniProt API for protein details by accession, and returns formatted data or error.private async handleGetProteinInfo(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid protein info arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: args.format || 'json', }, }); return { content: [ { type: 'text', text: args.format === 'json' ? JSON.stringify(response.data, null, 2) : String(response.data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein info: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:79-89 (schema)Input validation schema/type guard for get_protein_info tool arguments, ensuring accession is provided and format is valid.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)) ); };
- src/index.ts:730-731 (registration)Dispatch/registration in the CallToolRequestSchema switch statement mapping 'get_protein_info' to its handler.case 'get_protein_info': return this.handleGetProteinInfo(args);
- src/index.ts:43-63 (helper)TypeScript interface defining the structure of ProteinInfo, used in the context of protein data handling.interface ProteinInfo { primaryAccession: string; uniProtkbId: string; entryType: string; organism: { scientificName: string; commonName?: string; taxonId: number; }; proteinDescription: any; genes?: any[]; comments?: any[]; features?: any[]; keywords?: any[]; references?: any[]; sequence: { value: string; length: number; molWeight: number; }; }