Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

get_xrefs

Retrieve cross-references from external databases for Ensembl genes to connect genomic data with biological annotations and comparative genomics resources.

Instructions

Get external database cross-references for genes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idYesEnsembl gene ID
speciesNoSpecies name (default: homo_sapiens)
external_dbNoSpecific external database (optional)
all_levelsNoInclude transcript and translation xrefs (default: false)

Implementation Reference

  • The main handler function that executes the get_xrefs tool: validates input using isValidXrefArgs, queries Ensembl REST API at /xrefs/id/{gene_id} with species, external_db, and all_levels parameters, formats response as JSON, handles errors.
    private async handleGetXrefs(args: any) {
      if (!isValidXrefArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid xref arguments');
      }
    
      try {
        const species = this.getDefaultSpecies(args.species);
    
        const params: any = { species };
    
        if (args.external_db) {
          params.external_db = args.external_db;
        }
    
        if (args.all_levels) {
          params.all_levels = 1;
        }
    
        const response = await this.apiClient.get(`/xrefs/id/${args.gene_id}`, { params });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'fetching cross-references');
      }
  • src/index.ts:864-865 (registration)
    Registers the tool handler in the CallToolRequestSchema switch statement, mapping 'get_xrefs' calls to handleGetXrefs method.
    case 'get_xrefs':
      return this.handleGetXrefs(args);
  • src/index.ts:739-751 (registration)
    Tool metadata registration in ListToolsRequestSchema response: defines name, description, and inputSchema for discovery.
      name: 'get_xrefs',
      description: 'Get external database cross-references for genes',
      inputSchema: {
        type: 'object',
        properties: {
          gene_id: { type: 'string', description: 'Ensembl gene ID' },
          species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
          external_db: { type: 'string', description: 'Specific external database (optional)' },
          all_levels: { type: 'boolean', description: 'Include transcript and translation xrefs (default: false)' },
        },
        required: ['gene_id'],
      },
    },
  • Input validation type guard (schema) for get_xrefs tool arguments.
    const isValidXrefArgs = (
      args: any
    ): args is { gene_id: string; species?: string; external_db?: string; all_levels?: 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.external_db === undefined || typeof args.external_db === 'string') &&
        (args.all_levels === undefined || typeof args.all_levels === 'boolean')
      );
    };
  • TypeScript interface defining the expected structure of Ensembl cross-reference (xref) data.
    interface EnsemblXref {
      primary_id: string;
      display_id: string;
      version?: string;
      description?: string;
      dbname: string;
      info_type: string;
      info_text?: string;
      linkage_annotation?: string[];
    }
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 how it behaves—such as whether it's a read-only operation, what the output format looks like, potential rate limits, or error conditions. For a tool with zero annotation coverage, this is a significant gap.

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, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently communicates the essential function without unnecessary elaboration.

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 complexity of a tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, output format, or usage context, leaving significant gaps for an AI agent to understand how to effectively invoke this tool.

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?

The description doesn't add any parameter-specific information beyond what's already in the input schema, which has 100% coverage. It doesn't explain the meaning or implications of parameters like 'all_levels' or 'external_db' in context. However, since the schema coverage is high, the baseline score of 3 is appropriate.

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 action ('Get') and target resource ('external database cross-references for genes'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'lookup_gene' or 'search_genes' which might also retrieve gene-related information, so it doesn't reach the highest score.

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 when this tool is appropriate compared to siblings like 'lookup_gene' or 'search_genes', nor does it specify prerequisites or exclusions for usage.

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