Skip to main content
Glama
Augmented-Nature

Ensembl MCP Server

search_genes

Find genes by name, description, or identifier using the Ensembl database to retrieve genomic information for research and analysis.

Instructions

Search for genes by name, description, or identifier

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term (gene name, description, or partial match)
speciesNoSpecies name (default: homo_sapiens)
featureNoFeature type to search (default: gene)
biotypeNoFilter by biotype (e.g., protein_coding, lncRNA)
limitNoMaximum results (1-200, default: 25)

Implementation Reference

  • The handler function that executes the 'search_genes' tool. It validates input using isValidSearchArgs, constructs parameters for the Ensembl REST API /search endpoint, fetches results, and returns formatted JSON response.
    private async handleSearchGenes(args: any) {
      if (!isValidSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments');
      }
    
      try {
        const species = this.getDefaultSpecies(args.species);
        const feature = args.feature || 'gene';
        const limit = args.limit || 25;
    
        const params: any = {
          q: args.query,
          species,
          feature,
          limit,
        };
    
        if (args.biotype) {
          params.biotype = args.biotype;
        }
    
        const response = await this.apiClient.get('/search', { params });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleError(error, 'searching genes');
      }
    }
  • Input schema definition for the 'search_genes' tool, specifying parameters like query (required), species, feature, biotype, and limit in the ListTools response.
    name: 'search_genes',
    description: 'Search for genes by name, description, or identifier',
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search term (gene name, description, or partial match)' },
        species: { type: 'string', description: 'Species name (default: homo_sapiens)' },
        feature: { type: 'string', enum: ['gene', 'transcript'], description: 'Feature type to search (default: gene)' },
        biotype: { type: 'string', description: 'Filter by biotype (e.g., protein_coding, lncRNA)' },
        limit: { type: 'number', description: 'Maximum results (1-200, default: 25)', minimum: 1, maximum: 200 },
      },
      required: ['query'],
  • src/index.ts:840-841 (registration)
    Registration of the 'search_genes' tool handler in the CallToolRequestSchema switch statement, mapping tool name to handleSearchGenes method.
      return this.handleSearchGenes(args);
    // Sequence Data
  • Runtime validation type guard (isValidSearchArgs) for 'search_genes' tool input parameters, ensuring correct types and constraints.
    const isValidSearchArgs = (
      args: any
    ): args is { query: string; species?: string; feature?: string; biotype?: string; limit?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.query === 'string' &&
        args.query.length > 0 &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.feature === undefined || ['gene', 'transcript'].includes(args.feature)) &&
        (args.biotype === undefined || typeof args.biotype === 'string') &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 200))
      );
    };
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 the search functionality but doesn't describe what the search returns (e.g., list of gene objects, metadata), pagination behavior, rate limits, authentication needs, or error conditions. For a search tool with 5 parameters, this leaves significant gaps.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with every word contributing to understanding the core functionality.

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 search tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the search returns, how results are structured, or behavioral aspects like performance or limitations. The high schema coverage helps, but the overall context for agent usage is insufficient.

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%, with each parameter well-documented in the schema (e.g., query accepts partial matches, species defaults to homo_sapiens, feature has enum values, limit has range). The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline for high coverage.

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 verb 'search' and resource 'genes', specifying what fields can be searched (name, description, or identifier). However, it doesn't explicitly differentiate from sibling tools like 'lookup_gene' or 'batch_gene_lookup', which might have different search approaches or scopes.

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. With multiple sibling tools for gene-related operations (e.g., 'lookup_gene', 'batch_gene_lookup', 'get_gene_tree'), there's no indication of this tool's specific use case, prerequisites, or exclusions.

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