batch_confidence_analysis
Evaluate confidence scores for up to 30 protein structures using UniProt accessions. Gain insights into prediction reliability with batch processing on the AlphaFold MCP Server.
Instructions
Analyze confidence scores for multiple proteins
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uniprotIds | Yes | Array of UniProt accessions (max 30) |
Implementation Reference
- src/index.ts:1246-1312 (handler)The main handler function that implements the batch_confidence_analysis tool. It validates the input arguments, fetches AlphaFold prediction data for each UniProt ID, performs mock confidence analysis (average confidence, number of high/low confidence regions), compiles results for all inputs, and returns a JSON-formatted response.private async handleBatchConfidenceAnalysis(args: any) { if (!isValidBatchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid batch confidence analysis arguments'); } try { const results = []; for (const uniprotId of args.uniprotIds) { try { const response = await this.apiClient.get(`/prediction/${uniprotId}`); const structures = response.data; if (structures && structures.length > 0) { const structure = structures[0]; const sequenceLength = structure.uniprotSequence.length; // Mock confidence analysis const analysis = { uniprotId, sequenceLength, averageConfidence: Math.random() * 40 + 60, // 60-100 highConfidenceRegions: Math.floor(Math.random() * 5) + 1, lowConfidenceRegions: Math.floor(Math.random() * 3), }; results.push({ uniprotId, success: true, confidenceAnalysis: analysis, }); } else { results.push({ uniprotId, success: false, error: 'No structure found', }); } } catch (error) { results.push({ uniprotId, success: false, error: error instanceof Error ? error.message : 'Unknown error', }); } } return { content: [ { type: 'text', text: JSON.stringify({ batchConfidenceAnalysis: results }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error in batch confidence analysis: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:479-489 (registration)Tool registration in the ListTools response, defining the name, description, and input schema for batch_confidence_analysis.{ name: 'batch_confidence_analysis', description: 'Analyze confidence scores for multiple proteins', inputSchema: { type: 'object', properties: { uniprotIds: { type: 'array', items: { type: 'string' }, description: 'Array of UniProt accessions (max 30)', minItems: 1, maxItems: 30 }, }, required: ['uniprotIds'], }, },
- src/index.ts:83-95 (schema)Input validation type guard `isValidBatchArgs` used by the batch_confidence_analysis handler to validate the uniprotIds array and optional format.const isValidBatchArgs = ( args: any ): args is { uniprotIds: string[]; format?: string } => { return ( typeof args === 'object' && args !== null && Array.isArray(args.uniprotIds) && args.uniprotIds.length > 0 && args.uniprotIds.length <= 50 && args.uniprotIds.every((id: any) => typeof id === 'string' && id.length > 0) && (args.format === undefined || ['pdb', 'cif', 'bcif', 'json'].includes(args.format)) ); };
- src/index.ts:604-605 (registration)Dispatch registration in the CallToolRequestSchema switch statement that routes calls to the batch_confidence_analysis handler.case 'batch_confidence_analysis': return this.handleBatchConfidenceAnalysis(args);