Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

get_homologs

Find orthologous and paralogous genes across species using Ensembl data to identify evolutionary relationships and functional similarities between genes.

Instructions

Find orthologous and paralogous genes across species

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idYesEnsembl gene ID
speciesNoSource species name (default: homo_sapiens)
target_speciesNoTarget species to search (optional)
typeNoHomolog type (default: all)
formatNoOutput format (default: json)

Implementation Reference

  • The core handler function for the 'get_homologs' tool. It validates inputs, retrieves the source gene from Ensembl, searches for orthologs by gene symbol in a target species (default: mouse), and formats the response with source/ortholog details or fallback info if no ortholog found.
    private async handleGetHomologs(args: any) {
      if (!isValidHomologArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid homolog arguments');
      }
    
      try {
        const species = this.getDefaultSpecies(args.species);
    
        // Use overlap endpoint to get gene information from different species
        // This provides comparative information by looking up the same gene in different organisms
        const geneResponse = await this.apiClient.get(`/lookup/id/${args.gene_id}`, {
          params: { species }
        });
    
        const gene = geneResponse.data;
    
        // Get orthologs by looking up the same gene symbol in other species
        const targetSpecies = args.target_species || 'mus_musculus'; // Default to mouse
    
        try {
          const orthologResponse = await this.apiClient.get(`/lookup/symbol/${targetSpecies}/${gene.display_name}`);
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  source_gene: {
                    id: gene.id,
                    symbol: gene.display_name,
                    species: species,
                    description: gene.description,
                    location: `${gene.seq_region_name}:${gene.start}-${gene.end}`,
                    biotype: gene.biotype
                  },
                  ortholog: {
                    id: orthologResponse.data.id,
                    symbol: orthologResponse.data.display_name,
                    species: targetSpecies,
                    description: orthologResponse.data.description,
                    location: `${orthologResponse.data.seq_region_name}:${orthologResponse.data.start}-${orthologResponse.data.end}`,
                    biotype: orthologResponse.data.biotype
                  },
                  analysis: {
                    method: 'Gene symbol ortholog lookup',
                    conservation: 'Symbol-based orthology',
                    note: 'Genes with same symbol across species are typically orthologs'
                  }
                }, null, 2),
              },
            ],
          };
        } catch (orthologError) {
          // Return information about the source gene even if ortholog not found
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  source_gene: {
                    id: gene.id,
                    symbol: gene.display_name,
                    species: species,
                    description: gene.description,
                    location: `${gene.seq_region_name}:${gene.start}-${gene.end}`,
                    biotype: gene.biotype
                  },
                  ortholog_search: {
                    target_species: targetSpecies,
                    result: 'No ortholog found with same gene symbol',
                    suggestion: 'Try different target species or use gene family analysis'
                  },
                  available_data: {
                    gene_info: 'Complete source gene information available',
                    cross_references: 'Use get_xrefs tool for external database links',
                    sequences: 'Use get_sequence tool for sequence comparison'
                  }
                }, null, 2),
              },
            ],
          };
        }
      } catch (error) {
        return this.handleError(error, 'fetching comparative gene data');
      }
    }
  • JSON schema defining the input parameters for the get_homologs tool, including required gene_id and optional species, target_species, type, and format.
      type: 'object',
      properties: {
        gene_id: { type: 'string', description: 'Ensembl gene ID' },
        species: { type: 'string', description: 'Source species name (default: homo_sapiens)' },
        target_species: { type: 'string', description: 'Target species to search (optional)' },
        type: { type: 'string', enum: ['orthologues', 'paralogues', 'all'], description: 'Homolog type (default: all)' },
        format: { type: 'string', enum: ['json', 'xml'], description: 'Output format (default: json)' },
      },
      required: ['gene_id'],
    },
  • src/index.ts:654-667 (registration)
    Registration of the get_homologs tool in the ListToolsRequestSchema handler, providing name, description, and input schema.
      name: 'get_homologs',
      description: 'Find orthologous and paralogous genes across species',
      inputSchema: {
        type: 'object',
        properties: {
          gene_id: { type: 'string', description: 'Ensembl gene ID' },
          species: { type: 'string', description: 'Source species name (default: homo_sapiens)' },
          target_species: { type: 'string', description: 'Target species to search (optional)' },
          type: { type: 'string', enum: ['orthologues', 'paralogues', 'all'], description: 'Homolog type (default: all)' },
          format: { type: 'string', enum: ['json', 'xml'], description: 'Output format (default: json)' },
        },
        required: ['gene_id'],
      },
    },
  • src/index.ts:849-850 (registration)
    Tool handler dispatch in the CallToolRequestSchema switch statement, routing 'get_homologs' calls to handleGetHomologs.
    case 'get_homologs':
      return this.handleGetHomologs(args);
  • Type guard function for validating get_homologs input arguments before execution.
    const isValidHomologArgs = (
      args: any
    ): args is { gene_id: string; species?: string; target_species?: string; type?: string; format?: 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.target_species === undefined || typeof args.target_species === 'string') &&
        (args.type === undefined || ['orthologues', 'paralogues', 'all'].includes(args.type)) &&
        (args.format === undefined || ['json', 'xml'].includes(args.format))
      );
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe behavioral traits like rate limits, authentication needs, error handling, or output structure (e.g., what data is returned). For a tool with 5 parameters and no output schema, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Find orthologous and paralogous genes across species.' It is front-loaded with the core purpose, has zero waste, and is appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is incomplete. It lacks details on behavioral traits, output format beyond the 'format' parameter, and usage context. Without annotations or output schema, the description should compensate more to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond the schema, such as explaining relationships between parameters (e.g., how 'species' and 'target_species' interact) or usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Find orthologous and paralogous genes across species.' It specifies the verb ('find') and resource ('orthologous and paralogous genes'), making the action explicit. However, it doesn't distinguish this from sibling tools like 'get_gene_tree' or 'lookup_gene', which might involve related gene data, so it lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare to siblings such as 'get_gene_tree' (which might involve phylogenetic trees) or 'lookup_gene' (which might retrieve basic gene info). Usage is implied by the purpose but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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