batch_protein_lookup
Query multiple proteins in one operation using Human Protein Atlas data to retrieve details on expression, localization, and pathology in either JSON or TSV format.
Instructions
Look up multiple proteins simultaneously
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| columns | No | Specific columns to include in results | |
| format | No | Output format (default: json) | |
| genes | Yes | Array of gene symbols (max 100) |
Implementation Reference
- src/index.ts:1219-1255 (handler)The handler function that executes the batch_protein_lookup tool. It validates input, fetches protein data for each gene in parallel using Promise.all and this.fetchProteinData, collects results with success flags, and returns JSON-formatted batch results or error.private async handleBatchProteinLookup(args: any) { if (!isValidBatchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid batch lookup arguments'); } try { const results = await Promise.all( args.genes.map(async (gene: string) => { try { const data = await this.fetchProteinData(gene, args.format || 'json'); return { gene, data, success: true }; } catch (error) { return { gene, error: error instanceof Error ? error.message : 'Unknown error', success: false }; } }) ); return { content: [ { type: 'text', text: JSON.stringify({ batchResults: results }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error in batch lookup: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:625-633 (schema)Input schema for batch_protein_lookup tool, defining genes array (required, 1-100 strings), optional format (json/tsv), and columns.inputSchema: { type: 'object', properties: { genes: { type: 'array', items: { type: 'string' }, description: 'Array of gene symbols (max 100)', minItems: 1, maxItems: 100 }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, columns: { type: 'array', items: { type: 'string' }, description: 'Specific columns to include in results' }, }, required: ['genes'], },
- src/index.ts:622-634 (registration)Tool registration in the list of tools provided to ListToolsRequestHandler, including name, description, and inputSchema.{ name: 'batch_protein_lookup', description: 'Look up multiple proteins simultaneously', inputSchema: { type: 'object', properties: { genes: { type: 'array', items: { type: 'string' }, description: 'Array of gene symbols (max 100)', minItems: 1, maxItems: 100 }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, columns: { type: 'array', items: { type: 'string' }, description: 'Specific columns to include in results' }, }, required: ['genes'], }, },
- src/index.ts:700-701 (registration)Dispatch registration in the CallToolRequestHandler switch statement, routing calls to the handleBatchProteinLookup method.case 'batch_protein_lookup': return this.handleBatchProteinLookup(args);