Skip to main content
Glama

batch_sequence_fetch

Retrieve DNA or protein sequences for multiple genomic regions or feature IDs in JSON or FASTA format, supporting species-specific queries via the Ensembl REST API.

Instructions

Fetch sequences for multiple regions or features

Input Schema

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

Implementation Reference

  • The main execution handler for the 'batch_sequence_fetch' tool. It processes multiple regions by calling the single 'get_sequence' handler for each, collects successes and failures, and returns a batched JSON result.
    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:878-879 (registration)
    Registration of the tool handler in the central CallToolRequestSchema switch statement within setupToolHandlers().
    case 'batch_sequence_fetch': return this.handleBatchSequenceFetch(args);
  • src/index.ts:814-826 (registration)
    Tool metadata registration including name, description, and input schema in the ListToolsRequestSchema response.
    { 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'], }, },
  • Input validation type guard function defining the expected parameters and constraints for the batch_sequence_fetch tool (defined but not explicitly used in handler).
    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)) ); };

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