get_taxonomy_info
Retrieve detailed taxonomic information for organisms using UniProt accession numbers to identify species classification and relationships.
Instructions
Detailed taxonomic information for organisms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1897-1937 (handler)The handler function for 'get_taxonomy_info' that validates input, fetches protein data from UniProt API, extracts taxonomy details (organism, taxonomy ID, names, lineage), and returns formatted JSON.private async handleGetTaxonomyInfo(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid taxonomy info arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); const protein = response.data; const taxonomyInfo = { accession: protein.primaryAccession, organism: protein.organism, taxonomyId: protein.organism?.taxonId, scientificName: protein.organism?.scientificName, commonName: protein.organism?.commonName, lineage: protein.organism?.lineage || [], taxonomicDivision: protein.organism?.lineage?.[0] || 'Unknown', }; return { content: [ { type: 'text', text: JSON.stringify(taxonomyInfo, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching taxonomy info: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:712-717 (schema)Input schema definition for the 'get_taxonomy_info' tool, specifying the required 'accession' parameter.inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'],
- src/index.ts:784-785 (registration)Registration/dispatch in the CallToolRequestHandler switch statement that calls the handler for 'get_taxonomy_info'.case 'get_taxonomy_info': return this.handleGetTaxonomyInfo(args);
- src/index.ts:709-719 (registration)Tool registration in ListToolsRequestHandler, defining name, description, and input schema for 'get_taxonomy_info'.{ name: 'get_taxonomy_info', description: 'Detailed taxonomic information for organisms', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], }, },
- src/index.ts:79-89 (helper)Validation helper function used by 'get_taxonomy_info' handler to check input arguments.const isValidProteinInfoArgs = ( args: any ): args is { accession: string; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.accession === 'string' && args.accession.length > 0 && (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format)) ); };