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)
      );
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only mentions 'search' without specifying what is returned (e.g., protein records, sequences), whether results are paginated, if authentication is required, or any rate limits. For a search tool with zero annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient phrase with no wasted words. It's appropriately sized for the tool's complexity and front-loads the core purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the search returns (e.g., protein data, sequences), how results are structured, or any behavioral traits. For a search tool with 3 parameters and no structured output information, the description should provide more context about the search scope and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear parameter descriptions in the schema (e.g., 'NCBI taxonomy ID', 'Taxonomic name', 'Number of results to return'). The description adds no additional parameter semantics beyond what the schema already provides, so it meets the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Search by detailed taxonomic classification' states the action (search) and resource domain (taxonomic classification), but is vague about what exactly is being searched (proteins, sequences, etc.) and doesn't distinguish from sibling tools like 'search_by_function', 'search_by_gene', or 'get_taxonomy_info'. It provides basic purpose but lacks specificity about the search target.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'search_by_function', 'search_by_gene', 'get_taxonomy_info', or 'search_proteins'. The description doesn't mention prerequisites, exclusions, or comparative use cases, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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