get_protein_info
Retrieve detailed protein data including expression, localization, and pathology information from the Human Protein Atlas using gene symbols.
Instructions
Get detailed information for a specific protein by gene symbol
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gene | Yes | Gene symbol (e.g., BRCA1, TP53) | |
| format | No | Output format (default: json) |
Implementation Reference
- src/index.ts:837-863 (handler)Main handler function for 'get_protein_info' tool that validates input, fetches protein data, and returns JSON response or error.private async handleGetProteinInfo(args: any) { if (!isValidGeneArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene arguments'); } try { const result = await this.fetchProteinData(args.gene, args.format || 'json'); return { content: [ { type: 'text', text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching protein info: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:63-73 (schema)Input validation type guard 'isValidGeneArgs' used by the handler to check gene symbol and format parameters.const isValidGeneArgs = ( args: any ): args is { gene: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.gene === 'string' && args.gene.length > 0 && (args.format === undefined || ['json', 'tsv', 'xml', 'trig'].includes(args.format)) ); };
- src/index.ts:459-470 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and input schema definition.{ name: 'get_protein_info', description: 'Get detailed information for a specific protein by gene symbol', inputSchema: { type: 'object', properties: { gene: { type: 'string', description: 'Gene symbol (e.g., BRCA1, TP53)' }, format: { type: 'string', enum: ['json', 'tsv', 'xml', 'trig'], description: 'Output format (default: json)' }, }, required: ['gene'], }, },
- src/index.ts:671-672 (registration)Dispatch registration in CallToolRequestSchema switch statement routing to the handler.case 'get_protein_info': return this.handleGetProteinInfo(args);
- src/index.ts:738-741 (helper)Core helper method called by handler to fetch protein data via API search.private async fetchProteinData(gene: string, format: string = 'json'): Promise<any> { // Use searchProteins method which properly handles columns parameter return this.searchProteins(gene, format, undefined, 1); }