get_protein_orthologs
Retrieve protein orthologs from UniProt for evolutionary analysis by submitting a UniProt accession and specifying the target organism. Limit results for precise study focus.
Instructions
Identify orthologous proteins for evolutionary studies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number | |
| organism | No | Target organism to find orthologs in | |
| size | No | Number of results to return (1-100, default: 25) |
Implementation Reference
- src/index.ts:1086-1135 (handler)The main handler function that fetches protein info from UniProt API, constructs a search query using the gene name from the input accession and specified target organism, performs a UniProt search excluding the original accession, and returns the JSON results of potential orthologs.private async handleGetProteinOrthologs(args: any) { if (!isValidHomologArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid ortholog search arguments'); } try { // Get the protein info first const proteinResponse = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); const protein = proteinResponse.data; // Build ortholog search (similar function, different organism) let query = `reviewed:true`; if (protein.genes?.[0]?.geneName?.value) { query += ` AND gene:"${protein.genes[0].geneName.value}"`; } if (args.organism) { query += ` AND organism_name:"${args.organism}"`; } query += ` NOT accession:"${args.accession}"`; const response = await this.apiClient.get('/uniprotkb/search', { params: { query: query, format: 'json', size: args.size || 25, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error finding orthologs: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:489-501 (schema)Input schema definition and tool description registered in the ListToolsRequestSchema handler.name: 'get_protein_orthologs', description: 'Identify orthologous proteins for evolutionary studies', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, organism: { type: 'string', description: 'Target organism to find orthologs in' }, size: { type: 'number', description: 'Number of results to return (1-100, default: 25)', minimum: 1, maximum: 100 }, }, required: ['accession'], }, }, {
- src/index.ts:745-746 (registration)Dispatch registration in the CallToolRequestSchema switch statement that maps the tool name to its handler method.case 'get_phylogenetic_info': return this.handleGetPhylogeneticInfo(args);
- src/index.ts:130-141 (helper)Input validation helper function used by the get_protein_orthologs handler to validate arguments (shared with get_protein_homologs).const isValidHomologArgs = ( args: any ): args is { accession: string; organism?: string; size?: number } => { return ( typeof args === 'object' && args !== null && typeof args.accession === 'string' && args.accession.length > 0 && (args.organism === undefined || typeof args.organism === 'string') && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100)) ); };