Skip to main content
Glama

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"), },

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