Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

batch_sequence_fetch

Retrieve DNA sequences for multiple genomic regions or features from Ensembl in a single request, supporting up to 50 regions with configurable output formats.

Instructions

Fetch sequences for multiple regions or features

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionsYesList of regions or feature IDs (max 50)
speciesNoSpecies name (default: homo_sapiens)
formatNoOutput format (default: fasta)

Implementation Reference

  • The handler function for the 'batch_sequence_fetch' tool. It iterates over the provided regions, fetches sequences individually using handleGetSequence, collects results (success or error per region), and returns a batched JSON response.
    private async handleBatchSequenceFetch(args: any) {
      try {
        const species = this.getDefaultSpecies(args.species);
        const format = args.format || 'fasta';
    
        const results = [];
    
        for (const region of args.regions) {
          try {
            const sequenceResult = await this.handleGetSequence({
              region,
              species,
              format,
            });
            results.push({
              region,
              success: true,
              data: JSON.parse(sequenceResult.content[0].text),
            });
          } catch (error) {
            results.push({
              region,
              success: false,
              error: error instanceof Error ? error.message : 'Unknown error',
            });
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ batch_results: results }, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'batch sequence fetch');
      }
    }
  • src/index.ts:876-879 (registration)
    Registration in the tool dispatch switch statement within CallToolRequestSchema handler. Maps the tool name to its handler method.
    case 'batch_gene_lookup':
      return this.handleBatchGeneLookup(args);
    case 'batch_sequence_fetch':
      return this.handleBatchSequenceFetch(args);
  • src/index.ts:815-826 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and input schema.
      name: 'batch_sequence_fetch',
      description: 'Fetch sequences for multiple regions or features',
      inputSchema: {
        type: 'object',
        properties: {
          regions: { type: 'array', items: { type: 'string' }, description: 'List of regions or feature IDs (max 50)', minItems: 1, maxItems: 50 },
          species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
          format: { type: 'string', enum: ['json', 'fasta'], description: 'Output format (default: fasta)' },
        },
        required: ['regions'],
      },
    },
  • Type guard function for validating input arguments to batch_sequence_fetch, matching the inputSchema.
    const isValidBatchSequenceArgs = (
      args: any
    ): args is { regions: string[]; species?: string; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        Array.isArray(args.regions) &&
        args.regions.length > 0 &&
        args.regions.length <= 50 &&
        args.regions.every((r: any) => typeof r === 'string' && r.length > 0) &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.format === undefined || ['json', 'fasta'].includes(args.format))
      );
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden but offers minimal behavioral insight. It mentions fetching sequences but doesn't disclose critical traits like whether this is a read-only operation, potential rate limits, authentication requirements, or what happens with invalid inputs. The batch nature (max 50 items) is only hinted at in the schema, not the description.

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 directly states the tool's purpose without redundancy. It's front-loaded with the core action and scope, making it easy to parse. Every word contributes to understanding the tool's function.

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 batch operation tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain return values, error handling, or performance considerations. The complexity of batch processing warrants more context, especially without structured fields to compensate.

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%, so the schema fully documents parameters. The description adds no additional meaning beyond implying 'regions' can include 'features', which is already covered in the schema's description. No syntax examples or usage context are provided, meeting the baseline for high schema coverage.

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 verb 'fetch' and the resource 'sequences', specifying it's for 'multiple regions or features'. This distinguishes it from single-sequence tools like 'get_sequence' or 'get_cds_sequence' by emphasizing batch capability. However, it doesn't explicitly differentiate from all siblings like 'get_variants' which might also fetch sequences.

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. It doesn't mention scenarios like bulk processing vs. single queries, or compare to siblings such as 'get_sequence' for individual regions or 'search_genes' for gene-based queries. The agent must infer usage from the name and parameters 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/Ensembl-MCP-Server'

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