get_protein_info
Retrieve comprehensive protein details using a UniProt accession number. Choose output formats like JSON, TSV, FASTA, or XML for analysis and 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:837-870 (handler)The handler function that implements the core logic of the 'get_protein_info' tool. It validates input, fetches detailed protein information from the UniProt REST API using the provided accession, and returns the data in the specified format (default JSON).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)Type guard function for validating the input arguments of the 'get_protein_info' tool, ensuring 'accession' is a non-empty string and 'format' is one of the allowed values.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:415-425 (registration)Tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'get_protein_info'.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:730-731 (registration)Dispatch in the CallToolRequestSchema switch statement that routes calls to the 'get_protein_info' handler function.case 'get_protein_info': return this.handleGetProteinInfo(args);
- src/index.ts:417-424 (schema)The JSON schema definition for the input parameters of the 'get_protein_info' tool.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'], },