Skip to main content
Glama

search_by_taxonomy

Find UniProt entries by taxonomic classification using NCBI taxonomy IDs or names to retrieve relevant protein data.

Instructions

Search by detailed taxonomic classification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taxonomyIdNoNCBI taxonomy ID
taxonomyNameNoTaxonomic name (e.g., Mammalia, Bacteria)
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • The handler function that executes the tool's logic: validates input using isValidTaxonomySearchArgs, constructs a UniProt search query based on taxonomyId or taxonomyName, fetches results from the UniProt REST API, and returns formatted JSON or error.
    private async handleSearchByTaxonomy(args: any) { if (!isValidTaxonomySearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid taxonomy search arguments'); } try { let query = 'reviewed:true'; if (args.taxonomyId) { query += ` AND taxonomy_id:"${args.taxonomyId}"`; } if (args.taxonomyName) { query += ` AND taxonomy_name:"${args.taxonomyName}"`; } 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 searching by taxonomy: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }
  • The input schema definition for the search_by_taxonomy tool, specifying properties for taxonomyId, taxonomyName, and size.
    name: 'search_by_taxonomy', description: 'Search by detailed taxonomic classification', inputSchema: { type: 'object', properties: { taxonomyId: { type: 'number', description: 'NCBI taxonomy ID', minimum: 1 }, taxonomyName: { type: 'string', description: 'Taxonomic name (e.g., Mammalia, Bacteria)' }, size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 }, }, required: [], }, },
  • src/index.ts:770-771 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, mapping 'search_by_taxonomy' to handleSearchByTaxonomy.
    case 'search_by_taxonomy': return this.handleSearchByTaxonomy(args);
  • Helper validation function (type guard) that checks input arguments conform to the expected schema for search_by_taxonomy.
    const isValidTaxonomySearchArgs = ( args: any ): args is { taxonomyId?: number; taxonomyName?: string; size?: number } => { return ( typeof args === 'object' && args !== null && (args.taxonomyId === undefined || (typeof args.taxonomyId === 'number' && args.taxonomyId > 0)) && (args.taxonomyName === undefined || typeof args.taxonomyName === 'string') && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) && (args.taxonomyId !== undefined || args.taxonomyName !== undefined) ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/UniProt-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server