Skip to main content
Glama

search

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

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

  • MCP tool handler for the 'search' tool: calls WormBaseClient.search(), formats results as JSON text content or error response.
    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 input schema defining parameters for the 'search' tool: query (required string), type (optional enum), limit (optional number default 10).
    { 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"), },
  • src/index.ts:17-38 (registration)
    Registration of the 'search' MCP tool via server.tool(), including name, description, schema, and handler.
    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, }; } } );
  • WormBaseClient.search() method: performs search via WormMine API, parses results using parseWormMineResults, returns SearchResponse.
    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 interfaces for SearchResponse and SearchResult used in the search tool's output.
    export interface SearchResult { id: string; label: string; class: string; taxonomy?: string; description?: string; } 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