Skip to main content
Glama

get_strain

Retrieve C. elegans strain details including genotype, source, and phenotypes from WormBase. Use strain identifiers like 'N2' or 'CB1370' to access comprehensive biological data.

Instructions

Get information about a C. elegans strain including genotype, available from, and associated phenotypes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesStrain identifier - strain name (e.g., 'N2', 'CB1370')
widgetsNoSpecific widgets to fetch: overview, phenotypes, references

Implementation Reference

  • Handler function that executes the get_strain tool logic by calling WormBaseClient.getEntity with type 'strain' and returning formatted JSON response or error.
    async ({ id, widgets }) => { try { const data = await client.getEntity("strain", id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching strain: ${error}` }], isError: true, }; } }
  • Input schema validation using Zod for the get_strain tool parameters: id (string) and optional widgets (array of strings).
    { id: z.string().describe("Strain identifier - strain name (e.g., 'N2', 'CB1370')"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, phenotypes, references"), },
  • src/index.ts:133-153 (registration)
    Registration of the get_strain tool with the MCP server using server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "get_strain", "Get information about a C. elegans strain including genotype, available from, and associated phenotypes.", { id: z.string().describe("Strain identifier - strain name (e.g., 'N2', 'CB1370')"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, phenotypes, references"), }, async ({ id, widgets }) => { try { const data = await client.getEntity("strain", id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching strain: ${error}` }], isError: true, }; } } );
  • Core helper method in WormBaseClient that fetches data for any entity type (including 'strain') from WormBase REST API by requesting specified widgets and cleaning the response data.
    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; }

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