Skip to main content
Glama

batch_gene_lookup

Search for multiple genes in parallel within the Ensembl MCP Server. Input gene IDs and species to retrieve genomic data in JSON or XML format, supporting efficient bulk gene lookup.

Instructions

Look up multiple genes simultaneously

Input Schema

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

Implementation Reference

  • The handler function that executes the batch_gene_lookup tool. It validates arguments, constructs a batch request to Ensembl's /lookup/id POST endpoint, and returns the 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:876-877 (registration)
    Registers the batch_gene_lookup tool handler in the CallToolRequestSchema switch statement.
    case 'batch_gene_lookup': return this.handleBatchGeneLookup(args);
  • src/index.ts:802-812 (registration)
    Registers the batch_gene_lookup tool in the ListToolsRequestSchema response, including name, description, and input schema.
    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'], },
  • JSON schema defining the input parameters for the batch_gene_lookup tool.
    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'],
  • Helper function (type guard) that validates the input arguments for the batch_gene_lookup tool.
    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)) ); };

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