Skip to main content
Glama
WormBase

WormBase MCP Server

Official
by WormBase

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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool supports natural language queries and specific IDs, but lacks details on behavioral traits like rate limits, authentication needs, error handling, or result format. It adequately describes the core functionality but misses operational context.

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 appropriately sized and front-loaded, with two sentences that efficiently convey the tool's purpose and usage examples without unnecessary details, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/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 3 parameters, no annotations, and no output schema, the description is incomplete. It lacks information on result format, pagination, error cases, or how it differs from sibling tools, leaving gaps for an AI agent to understand full behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the baseline is 3. The description adds value by explaining the 'query' parameter semantics with examples ('genes involved in longevity', 'WBGene00006763'), enhancing understanding beyond the schema, though it doesn't cover all parameters in detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('search WormBase') and resources ('genes, proteins, phenotypes, strains, and other biological entities'), distinguishing it from sibling tools that fetch specific entity types rather than performing general searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for usage by specifying what can be searched (biological entities) and giving query examples, but it does not explicitly state when to use this tool versus the sibling 'get_*' tools or provide 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/WormBase/wormbase-mcp'

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