Skip to main content
Glama

search

Search WormBase for genes, proteins, phenotypes, strains, and other biological entities using natural language queries or specific IDs to retrieve genomics data.

Instructions

Search WormBase for genes, proteins, phenotypes, strains, and other biological entities. Supports natural language queries like 'genes involved in longevity' or specific IDs like 'WBGene00006763'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query - can be a gene name (e.g., 'daf-2', 'unc-13'), WormBase ID (e.g., 'WBGene00006763'), or natural language description
typeNoEntity type to search for. If not specified, searches all types.
limitNoMaximum number of results to return

Implementation Reference

  • src/index.ts:17-38 (registration)
    Registration of the 'search' MCP tool, including name, description, Zod input schema, and inline handler function.
    server.tool( "search", "Search WormBase for genes, proteins, phenotypes, strains, and other biological entities. Supports natural language queries like 'genes involved in longevity' or specific IDs like 'WBGene00006763'.", { query: z.string().describe("Search query - can be a gene name (e.g., 'daf-2', 'unc-13'), WormBase ID (e.g., 'WBGene00006763'), or natural language description"), type: z.enum(ENTITY_TYPES).optional().describe("Entity type to search for. If not specified, searches all types."), limit: z.number().optional().default(10).describe("Maximum number of results to return"), }, async ({ query, type, limit }) => { try { const results = await client.search(query, type, limit); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error searching WormBase: ${error}` }], isError: true, }; } } );
  • The MCP tool handler for 'search', which delegates to WormBaseClient.search() and formats the response as text content or error.
    async ({ query, type, limit }) => { try { const results = await client.search(query, type, limit); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error searching WormBase: ${error}` }], isError: true, }; } }
  • Zod schema defining the input parameters for the 'search' tool: query (required string), type (optional enum), limit (optional number).
    { query: z.string().describe("Search query - can be a gene name (e.g., 'daf-2', 'unc-13'), WormBase ID (e.g., 'WBGene00006763'), or natural language description"), type: z.enum(ENTITY_TYPES).optional().describe("Entity type to search for. If not specified, searches all types."), limit: z.number().optional().default(10).describe("Maximum number of results to return"), },
  • WormBaseClient.search() method: performs HTTP search request to WormMine API, parses results, filters by type if specified, handles errors.
    async search( query: string, type?: EntityType, limit: number = 10 ): Promise<SearchResponse> { const url = `${this.wormmineUrl}/search?q=${encodeURIComponent(query)}&size=${limit}`; try { const response = await this.fetch<any>(url); const results = this.parseWormMineResults(response, type, limit); return { query, results, total: response.totalHits || results.length, }; } catch (error) { return { query, results: [], total: 0 }; } }
  • TypeScript interface defining the structure of the SearchResponse returned by the search implementation.
    export interface SearchResponse { query: string; results: SearchResult[]; total: number; }

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/WormBase/wormbase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server