Skip to main content
Glama

get_gene

Retrieve comprehensive C. elegans gene data including function, expression, phenotypes, and orthologs from WormBase to support genetic research and analysis.

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

  • MCP tool handler for 'get_gene': calls client.getGene, formats JSON response, handles errors
    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, }; } }
  • Zod input schema defining parameters id (string) and optional widgets (array of strings) for the get_gene tool
    { 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"), },
  • src/index.ts:41-61 (registration)
    Registration of the 'get_gene' tool with McpServer using server.tool(name, description, schema, handler)
    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, }; } } );
  • WormBaseClient.getGene method: resolves gene ID if necessary, fetches specified widgets from WormBase REST API, cleans data, handles errors per widget
    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; }

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