Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

batch_gene_lookup

Retrieve genomic data for multiple genes at once from Ensembl, supporting up to 200 gene IDs per query with JSON or XML output.

Instructions

Look up multiple genes simultaneously

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idsYesList of gene IDs (max 200)
speciesNoSpecies name (default: homo_sapiens)
formatNoOutput format (default: json)

Implementation Reference

  • The main handler function for the 'batch_gene_lookup' tool. Validates input, makes a POST request to Ensembl's /lookup/id endpoint with multiple gene IDs for batch lookup, and returns the formatted JSON response.
    private async handleBatchGeneLookup(args: any) {
      if (!isValidBatchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid batch gene lookup arguments');
      }
    
      try {
        const species = this.getDefaultSpecies(args.species);
        const format = args.format || 'json';
    
        const geneData = { ids: args.gene_ids };
    
        const response = await this.apiClient.post('/lookup/id', geneData, {
          params: { species, format },
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'batch gene lookup');
      }
    }
  • src/index.ts:802-813 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for batch_gene_lookup.
      name: 'batch_gene_lookup',
      description: 'Look up multiple genes simultaneously',
      inputSchema: {
        type: 'object',
        properties: {
          gene_ids: { type: 'array', items: { type: 'string' }, description: 'List of gene IDs (max 200)', minItems: 1, maxItems: 200 },
          species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
          format: { type: 'string', enum: ['json', 'xml'], description: 'Output format (default: json)' },
        },
        required: ['gene_ids'],
      },
    },
  • Input schema definition for the batch_gene_lookup tool, specifying parameters like gene_ids array (required, 1-200 items), optional species and format.
      type: 'object',
      properties: {
        gene_ids: { type: 'array', items: { type: 'string' }, description: 'List of gene IDs (max 200)', minItems: 1, maxItems: 200 },
        species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
        format: { type: 'string', enum: ['json', 'xml'], description: 'Output format (default: json)' },
      },
      required: ['gene_ids'],
    },
  • Helper function to validate input arguments for batch_gene_lookup, checking gene_ids is non-empty array <=200 strings, and optional species/format.
    const isValidBatchArgs = (
      args: any
    ): args is { gene_ids: string[]; species?: string; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        Array.isArray(args.gene_ids) &&
        args.gene_ids.length > 0 &&
        args.gene_ids.length <= 200 &&
        args.gene_ids.every((id: any) => typeof id === 'string' && id.length > 0) &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.format === undefined || ['json', 'xml'].includes(args.format))
      );
    };
  • src/index.ts:876-879 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing calls to batch_gene_lookup to its handler.
    case 'batch_gene_lookup':
      return this.handleBatchGeneLookup(args);
    case 'batch_sequence_fetch':
      return this.handleBatchSequenceFetch(args);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'look up' implies a read-only operation, it doesn't specify authentication requirements, rate limits, error handling, or what information is returned about each gene. The description lacks crucial behavioral context for a tool with 3 parameters and no output schema.

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 sentence that communicates the core purpose without any wasted words. It's appropriately sized for a straightforward batch lookup tool and gets directly to the point.

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?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'look up' returns (gene details, sequences, annotations?), doesn't mention performance considerations for batch operations, and provides no context about the data source or limitations beyond what's in the parameter schema.

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?

With 100% schema description coverage, the schema already documents all parameters thoroughly (gene_ids with limits, species with default, format with enum). The description adds no additional parameter semantics beyond what's in the schema, so the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('look up') and target resource ('multiple genes simultaneously'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'lookup_gene' (singular) or 'search_genes', leaving some ambiguity about when to choose this batch version over alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives like 'lookup_gene' or 'search_genes'. It mentions 'multiple genes simultaneously' which implies batch processing, but doesn't explicitly state this as the primary use case or provide any exclusion criteria or prerequisites.

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/Ensembl-MCP-Server'

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