Skip to main content
Glama
WormBase

WormBase MCP Server

Official
by WormBase

get_gene

Retrieve detailed C. elegans gene data including function, expression, phenotypes, and orthologs from WormBase. Use gene identifiers or names to access comprehensive biological information.

Instructions

Get detailed information about a C. elegans gene including description, function, expression, phenotypes, and orthologs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesGene identifier - WormBase ID (e.g., 'WBGene00006763') or gene name (e.g., 'daf-2', 'unc-13')
widgetsNoSpecific widgets to fetch: overview, expression, phenotype, interactions, homology, sequences, genetics, external_links, references

Implementation Reference

  • Core handler function that implements the get_gene tool logic: resolves non-WBGene IDs using WormMine, fetches data for specified or default widgets from WormBase REST API, cleans the response data, and handles per-widget errors.
    async getGene(
      id: string,
      widgets?: string[]
    ): Promise<Record<string, unknown>> {
      // Resolve gene name to WBGene ID if needed
      let geneId = id;
      if (!id.startsWith("WBGene")) {
        const resolved = await this.resolveGeneId(id);
        if (resolved) {
          geneId = resolved;
        }
      }
    
      const defaultWidgets = ["overview", "phenotype", "expression", "ontology"];
      const requestedWidgets = widgets || defaultWidgets;
    
      const result: Record<string, unknown> = { id: geneId, query: id };
    
      for (const widget of requestedWidgets) {
        try {
          const url = `${this.baseUrl}/rest/widget/gene/${encodeURIComponent(geneId)}/${widget}`;
          const data = await this.fetch<any>(url);
          result[widget] = this.cleanWidgetData(data);
        } catch (error) {
          result[widget] = { error: `Failed to fetch ${widget}` };
        }
      }
    
      return result;
    }
  • src/index.ts:41-61 (registration)
    MCP tool registration for 'get_gene', including description, Zod input schema, and thin handler that calls WormBaseClient.getGene and formats response as MCP content.
    server.tool(
      "get_gene",
      "Get detailed information about a C. elegans gene including description, function, expression, phenotypes, and orthologs.",
      {
        id: z.string().describe("Gene identifier - WormBase ID (e.g., 'WBGene00006763') or gene name (e.g., 'daf-2', 'unc-13')"),
        widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, expression, phenotype, interactions, homology, sequences, genetics, external_links, references"),
      },
      async ({ id, widgets }) => {
        try {
          const data = await client.getGene(id, widgets);
          return {
            content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error fetching gene: ${error}` }],
            isError: true,
          };
        }
      }
    );
  • Supporting helper used by getGene to resolve gene names/symbols to canonical WBGene IDs via WormMine search API.
    async resolveGeneId(name: string): Promise<string | null> {
      const url = `${this.wormmineUrl}/search?q=${encodeURIComponent(name)}&facet_Category=Gene&size=1`;
    
      try {
        const response = await this.fetch<any>(url);
        if (response.results?.[0]?.fields?.primaryIdentifier) {
          return response.results[0].fields.primaryIdentifier;
        }
      } catch {
        // Fall through
      }
      return null;
    }
  • Zod schema defining input parameters for the get_gene tool: required 'id' string and optional 'widgets' array.
    {
      id: z.string().describe("Gene identifier - WormBase ID (e.g., 'WBGene00006763') or gene name (e.g., 'daf-2', 'unc-13')"),
      widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, expression, phenotype, interactions, homology, sequences, genetics, external_links, references"),
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what information is returned but doesn't describe how the tool behaves: e.g., whether it's a read-only operation (implied by 'Get'), error handling for invalid IDs, rate limits, authentication needs, or what happens if widgets are omitted. This leaves significant gaps for a tool with no annotation coverage.

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 front-loads the core purpose and lists included information without unnecessary words. Every part earns its place by specifying scope and content.

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 tool's moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers what the tool does but lacks behavioral details and usage guidance. Without annotations or output schema, more context on behavior and returns would improve completeness for a read operation.

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%, so the schema already fully documents both parameters (id and widgets). The description adds no additional parameter semantics beyond what's in the schema, such as explaining the relationship between id formats or widget options. Baseline 3 is appropriate when the schema does all the work.

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 'Get' and resource 'detailed information about a C. elegans gene', specifying what information is included (description, function, expression, phenotypes, orthologs). It distinguishes from siblings like get_disease or get_protein by focusing on genes, though it doesn't explicitly contrast with similar tools like get_entity or search.

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. It doesn't mention when to choose get_gene over get_entity (which might be more general) or search (which might find genes among other things), nor does it specify prerequisites or exclusions for usage.

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