Skip to main content
Glama

get_gene_tree

Retrieve phylogenetic trees for gene families to analyze evolutionary relationships and gene function across species using Ensembl genomic data.

Instructions

Get phylogenetic tree for gene family

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idYesEnsembl gene ID
speciesNoSpecies name (default: homo_sapiens)
formatNoTree format (default: json)
clusterset_idNoSpecific clusterset ID (optional)

Implementation Reference

  • The handler function for the 'get_gene_tree' tool. Validates input using isValidGeneTreeArgs, constructs Ensembl REST API request to /genetree/id/{gene_id}, handles format and clusterset_id parameters, fetches the phylogenetic tree data, and returns it as formatted text content.
    private async handleGetGeneTree(args: any) { if (!isValidGeneTreeArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene tree arguments'); } try { const format = args.format || 'json'; let endpoint = `/genetree/id/${args.gene_id}`; const params: any = {}; if (args.clusterset_id) { params.clusterset_id = args.clusterset_id; } if (format !== 'json') { params.format = format; } const response = await this.apiClient.get(endpoint, { params }); return { content: [ { type: 'text', text: typeof response.data === 'object' ? JSON.stringify(response.data, null, 2) : String(response.data), }, ], }; } catch (error) { return this.handleError(error, 'fetching gene tree'); } }
  • Input validation type guard (schema) for get_gene_tree tool arguments: requires gene_id string, optional species, format (json/newick/phyloxml), clusterset_id.
    const isValidGeneTreeArgs = ( args: any ): args is { gene_id: string; species?: string; format?: string; clusterset_id?: string } => { return ( typeof args === 'object' && args !== null && typeof args.gene_id === 'string' && args.gene_id.length > 0 && (args.species === undefined || typeof args.species === 'string') && (args.format === undefined || ['json', 'newick', 'phyloxml'].includes(args.format)) && (args.clusterset_id === undefined || typeof args.clusterset_id === 'string') ); };
  • src/index.ts:669-681 (registration)
    Tool registration definition in the listTools response, including name, description, and detailed inputSchema matching the validator.
    name: 'get_gene_tree', description: 'Get phylogenetic tree for gene family', inputSchema: { type: 'object', properties: { gene_id: { type: 'string', description: 'Ensembl gene ID' }, species: { type: 'string', description: 'Species name (default: homo_sapiens)' }, format: { type: 'string', enum: ['json', 'newick', 'phyloxml'], description: 'Tree format (default: json)' }, clusterset_id: { type: 'string', description: 'Specific clusterset ID (optional)' }, }, required: ['gene_id'], }, },
  • src/index.ts:851-852 (registration)
    Dispatch case in the CallToolRequestSchema switch statement that routes 'get_gene_tree' calls to the handleGetGeneTree handler.
    case 'get_gene_tree': return this.handleGetGeneTree(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