Skip to main content
Glama

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);

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