Skip to main content
Glama

ensembl_sequence

Retrieve DNA, RNA, or protein sequences for genes, transcripts, or genomic regions from the Ensembl database across multiple species.

Instructions

Retrieve DNA, RNA, or protein sequences for genes, transcripts, regions. Covers /sequence/id and /sequence/region endpoints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesFeature ID (gene, transcript, etc.) OR genomic region in format 'chr:start-end' (e.g., 'ENSG00000141510', 'ENST00000288602', '17:7565096-7590856', 'X:1000000-2000000')
sequence_typeNoType of sequence to retrievegenomic
speciesNoSpecies name (e.g., 'homo_sapiens', 'mus_musculus')homo_sapiens
formatNoOutput formatjson
maskNoMask repeats (soft=lowercase, hard=N)

Implementation Reference

  • MCP tool registration definition for 'ensembl_sequence' including description and input schema.
    { name: "ensembl_sequence", description: "Retrieve DNA, RNA, or protein sequences for genes, transcripts, regions. Covers /sequence/id and /sequence/region endpoints.", inputSchema: { type: "object", properties: { identifier: { type: "string", description: "Feature ID (gene, transcript, etc.) OR genomic region in format 'chr:start-end' (e.g., 'ENSG00000141510', 'ENST00000288602', '17:7565096-7590856', 'X:1000000-2000000')", }, sequence_type: { type: "string", enum: ["genomic", "cdna", "cds", "protein"], description: "Type of sequence to retrieve", default: "genomic", }, species: { type: "string", description: "Species name (e.g., 'homo_sapiens', 'mus_musculus')", default: "homo_sapiens", }, format: { type: "string", enum: ["json", "fasta"], description: "Output format", default: "json", }, mask: { type: "string", enum: ["soft", "hard"], description: "Mask repeats (soft=lowercase, hard=N)", }, }, required: ["identifier"], }, },
  • Tool handler function that processes arguments, normalizes inputs, calls the Ensembl API client, and handles errors.
    export async function handleSequence(args: any) { try { const normalizedArgs = normalizeEnsemblInputs(args); return await ensemblClient.getSequenceData(normalizedArgs); } catch (error) { return { error: error instanceof Error ? error.message : "Unknown error", success: false, }; } }
  • Core helper method implementing the Ensembl REST API calls for retrieving sequence data (/sequence/id or /sequence/region).
    async getSequenceData(args: any): Promise<any> { const { identifier, sequence_type = "genomic", species = "homo_sapiens", format = "json", mask, } = args; const params: Record<string, string> = {}; if (mask) { params.mask = mask; } if (format === "fasta") { params.content_type = "text/x-fasta"; } // Check if identifier looks like a region (contains :) if (identifier.includes(":")) { return this.makeRequest( `/sequence/region/${species}/${identifier}`, params ); } else { // It's a feature ID const typeParam = sequence_type !== "genomic" ? `?type=${sequence_type}` : ""; return this.makeRequest(`/sequence/id/${identifier}${typeParam}`, params); } }
  • TypeScript interface defining the structure of Ensembl sequence responses.
    export interface EnsemblSequence { id: string; desc: string; molecule: string; seq: string; }
  • index.ts:119-127 (registration)
    MCP server dispatch case that maps 'ensembl_sequence' tool calls to the handleSequence function.
    case "ensembl_sequence": return { content: [ { type: "text", text: JSON.stringify(await handleSequence(args), null, 2), }, ], };

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/effieklimi/ensembl-mcp-server'

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