get_organism_stats
Retrieve AlphaFold coverage statistics for a specific organism to analyze protein structure prediction data. Input the organism name for detailed insights.
Instructions
Get statistics about AlphaFold coverage for an organism
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organism | Yes | Organism name |
Implementation Reference
- src/index.ts:857-922 (handler)The handler function that executes the get_organism_stats tool. It validates input, queries the AlphaFold API for predictions of the specified organism, computes statistics on structure count, coverage (average, full-length vs partial), and returns formatted JSON.private async handleGetOrganismStats(args: any) { if (!isValidOrganismArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid organism stats arguments'); } try { const response = await this.apiClient.get('/prediction', { params: { organism: args.organism, size: 1000, // Get more for statistics }, }); const structures = response.data; const stats = { organism: args.organism, totalStructures: structures.length, coverageStats: { averageCoverage: 0, fullLength: 0, partial: 0, }, confidenceStats: { highConfidence: 0, mediumConfidence: 0, lowConfidence: 0, }, lastUpdated: new Date().toISOString(), }; // Calculate coverage and confidence statistics if (structures.length > 0) { structures.forEach((struct: any) => { const coverage = ((struct.uniprotEnd - struct.uniprotStart + 1) / struct.uniprotSequence.length) * 100; stats.coverageStats.averageCoverage += coverage; if (coverage >= 95) { stats.coverageStats.fullLength++; } else { stats.coverageStats.partial++; } }); stats.coverageStats.averageCoverage /= structures.length; } return { content: [ { type: 'text', text: JSON.stringify(stats, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting organism stats: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:408-418 (registration)Tool registration in ListToolsRequestSchema handler, defining the tool name, description, and input schema requiring 'organism' string.{ name: 'get_organism_stats', description: 'Get statistics about AlphaFold coverage for an organism', inputSchema: { type: 'object', properties: { organism: { type: 'string', description: 'Organism name' }, }, required: ['organism'], }, },
- src/index.ts:97-107 (schema)Input validation helper function isValidOrganismArgs used by the handler to validate arguments, checking organism is non-empty string and optional size is valid number.const isValidOrganismArgs = ( args: any ): args is { organism: string; size?: number } => { return ( typeof args === 'object' && args !== null && typeof args.organism === 'string' && args.organism.length > 0 && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100)) ); };
- src/index.ts:590-591 (registration)Dispatch in CallToolRequestSchema switch statement that routes calls to get_organism_stats to its handler function.case 'get_organism_stats': return this.handleGetOrganismStats(args);