Skip to main content
Glama

get_disease

Retrieve human disease information using C. elegans models, including associated genes and orthologs from the WormBase database.

Instructions

Get information about human diseases with C. elegans models, including associated genes and orthologs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDisease identifier - DOID or WormBase disease ID
widgetsNoSpecific widgets to fetch: overview, genes, references

Implementation Reference

  • src/index.ts:109-130 (registration)
    Registers the 'get_disease' MCP tool, including description, Zod input schema for 'id' and optional 'widgets', and thin async handler that delegates to WormBaseClient.getEntity('disease', id, widgets), formats response as JSON text content, with error handling.
    // Tool: Get Disease Information server.tool( "get_disease", "Get information about human diseases with C. elegans models, including associated genes and orthologs.", { id: z.string().describe("Disease identifier - DOID or WormBase disease ID"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, genes, references"), }, async ({ id, widgets }) => { try { const data = await client.getEntity("disease", id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching disease: ${error}` }], isError: true, }; } } );
  • Implements the core logic for the get_disease tool by fetching WormBase REST API widget data for 'disease' entities (/rest/widget/disease/{id}/{widget}), processing multiple widgets, cleaning data with cleanWidgetData helper, and returning aggregated result object.
    async getEntity( type: EntityType, id: string, widgets?: string[] ): Promise<Record<string, unknown>> { const defaultWidgets = ["overview"]; const requestedWidgets = widgets || defaultWidgets; const result: Record<string, unknown> = { id, type }; for (const widget of requestedWidgets) { try { const url = `${this.baseUrl}/rest/widget/${type}/${encodeURIComponent(id)}/${widget}`; const data = await this.fetch<any>(url); result[widget] = this.cleanWidgetData(data); } catch (error) { result[widget] = { error: `Failed to fetch ${widget}` }; } } return result; }
  • Helper function used by getEntity to clean and simplify raw WormBase API widget data, handling fields unwrapping, nulls, nested objects, entity references, and recursive simplification.
    private cleanWidgetData(data: any): Record<string, unknown> { if (!data) return {}; // The API typically wraps data in a "fields" object const fields = data.fields || data; // Clean and simplify the data structure const cleaned: Record<string, unknown> = {}; for (const [key, value] of Object.entries(fields)) { if (value === null || value === undefined) continue; // Handle nested data structures if (typeof value === "object" && value !== null) { const obj = value as Record<string, unknown>; if ("data" in obj) { cleaned[key] = obj.data; } else if ("id" in obj && "label" in obj) { // Entity reference cleaned[key] = { id: obj.id, label: obj.label, class: obj.class || obj.taxonomy, }; } else { cleaned[key] = this.simplifyValue(value); } } else { cleaned[key] = value; } } return cleaned; }
  • Defines 'disease' as a valid EntityType in the ENTITY_TYPES const array, used in type safety for getEntity calls.
    "disease",

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