Skip to main content
Glama

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)) ); };

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