Skip to main content
Glama

get_transcripts

Retrieve all transcripts for a specific gene, including structural details, using the Ensembl MCP Server. Specify a gene ID and optionally filter for canonical transcripts or adjust species.

Instructions

Get all transcripts for a gene with detailed structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
canonical_onlyNoReturn only canonical transcript (default: false)
gene_idYesEnsembl gene ID
speciesNoSpecies name (default: homo_sapiens)

Implementation Reference

  • The core handler function for the 'get_transcripts' tool. Validates input, fetches gene data with expanded transcripts from Ensembl REST API (/lookup/id/{gene_id}?expand=1), filters optional canonical transcripts, and formats the response with gene info and transcript details.
    private async handleGetTranscripts(args: any) { if (!isValidTranscriptArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid transcript arguments'); } try { const species = this.getDefaultSpecies(args.species); const response = await this.apiClient.get(`/lookup/id/${args.gene_id}`, { params: { species, expand: 1 }, }); const gene = response.data; let transcripts = gene.Transcript || []; if (args.canonical_only) { transcripts = transcripts.filter((t: any) => t.is_canonical === 1); } return { content: [ { type: 'text', text: JSON.stringify({ gene_id: gene.id, gene_name: gene.display_name, transcript_count: transcripts.length, transcripts: transcripts, }, null, 2), }, ], }; } catch (error) { return this.handleError(error, 'fetching transcripts'); } }
  • Input validation type guard (schema) specifically for 'get_transcripts' tool arguments: requires gene_id string, optional species and canonical_only boolean.
    const isValidTranscriptArgs = ( args: any ): args is { gene_id: string; species?: string; canonical_only?: boolean } => { return ( typeof args === 'object' && args !== null && typeof args.gene_id === 'string' && args.gene_id.length > 0 && (args.species === undefined || typeof args.species === 'string') && (args.canonical_only === undefined || typeof args.canonical_only === 'boolean') ); };
  • src/index.ts:584-595 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and input schema definition.
    name: 'get_transcripts', description: 'Get all transcripts for a gene with detailed structure', inputSchema: { type: 'object', properties: { gene_id: { type: 'string', description: 'Ensembl gene ID' }, species: { type: 'string', description: 'Species name (default: homo_sapiens)' }, canonical_only: { type: 'boolean', description: 'Return only canonical transcript (default: false)' }, }, required: ['gene_id'], }, },
  • src/index.ts:838-838 (registration)
    Dispatch/registration of the tool handler in the CallToolRequestSchema switch statement.
    return this.handleGetTranscripts(args);
  • TypeScript interface defining the structure of EnsemblTranscript objects used in the tool's response.
    interface EnsemblTranscript { id: string; parent: string; display_name: string; biotype: string; start: number; end: number; strand: number; is_canonical?: number; length: number; version: number; Translation?: { id: string; start: number; end: number; length: number; }; Exon?: EnsemblExon[]; }

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