Skip to main content
Glama

get_disease

Retrieve details on human diseases with C. elegans models, including associated genes and orthologs, using disease identifiers like DOID or WormBase IDs.

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:110-130 (registration)
    Registers the 'get_disease' MCP tool with input schema (id, optional widgets) and handler that fetches data using WormBaseClient.getEntity for disease entities.
    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, }; } } );
  • Core handler logic for fetching WormBase entity data (used by get_disease with type='disease') via REST API widget endpoints, aggregating multiple widgets.
    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 cleanWidgetData used by getEntity to process and simplify raw API responses from WormBase.
    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; } private simplifyValue(value: unknown): unknown { if (Array.isArray(value)) { return value.map(v => this.simplifyValue(v)); } if (typeof value === "object" && value !== null) { const obj = value as Record<string, unknown>; // Handle entity references if ("id" in obj && "label" in obj) { return { id: obj.id, label: obj.label, class: obj.class, }; } // Handle data wrapper if ("data" in obj && Object.keys(obj).length <= 2) { return this.simplifyValue(obj.data); } // Recursively simplify nested objects const simplified: Record<string, unknown> = {}; for (const [k, v] of Object.entries(obj)) { if (v !== null && v !== undefined) { simplified[k] = this.simplifyValue(v); } } return simplified; } return value; }
  • Type definitions including ENTITY_TYPES const array which includes 'disease', used in getEntity type parameter.
    export const ENTITY_TYPES = [ "gene", "protein", "transcript", "cds", "pseudogene", "phenotype", "disease", "strain", "variation", "transgene", "rnai", "anatomy_term", "life_stage", "go_term", "interaction", "expression_cluster", "expr_pattern", "paper", "person", "laboratory", "clone", "sequence", "feature", "operon", "gene_class", "molecule", "antibody", "construct", "motif", "homology_group", "rearrangement", "transposon", "transposon_family", "pcr_oligo", "position_matrix", "microarray_results", "structure_data", "analysis", "gene_cluster", "expr_profile", ] as const;

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