Skip to main content
Glama

get_entity

Retrieve detailed information about WormBase entities like genes, proteins, phenotypes, and expression patterns using entity type and identifier.

Instructions

Get information about any WormBase entity type. Use this for entity types not covered by specific tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesEntity type
idYesEntity identifier
widgetsNoSpecific widgets to fetch

Implementation Reference

  • MCP tool handler function for 'get_entity' that calls WormBaseClient.getEntity(type, id, widgets) and returns the data as JSON text or error response.
    async ({ type, id, widgets }) => { try { const data = await client.getEntity(type, id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching entity: ${error}` }], isError: true, }; } }
  • Input schema (Zod) for the get_entity tool defining parameters: type (enum from ENTITY_TYPES), id (string), optional widgets (string array).
    { type: z.enum(ENTITY_TYPES).describe("Entity type"), id: z.string().describe("Entity identifier"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch"), },
  • src/index.ts:246-267 (registration)
    Registration of the 'get_entity' MCP tool using server.tool(), including name, description, schema, and handler function.
    server.tool( "get_entity", "Get information about any WormBase entity type. Use this for entity types not covered by specific tools.", { type: z.enum(ENTITY_TYPES).describe("Entity type"), id: z.string().describe("Entity identifier"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch"), }, async ({ type, id, widgets }) => { try { const data = await client.getEntity(type, id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching entity: ${error}` }], isError: true, }; } } );
  • WormBaseClient.getEntity method, the core helper function that fetches specified widgets for a given entity type and ID from the WormBase REST API.
    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; }
  • TypeScript type definitions for EntityType and ENTITY_TYPES const array, used in the Zod schema for the 'type' parameter in get_entity tool.
    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; export type EntityType = (typeof ENTITY_TYPES)[number];

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