Skip to main content
Glama

get_interactions

Retrieve protein-protein, genetic, or regulatory interactions for C. elegans genes and proteins from the WormBase database to analyze biological relationships.

Instructions

Get protein-protein, genetic, or regulatory interactions for a gene or protein.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesGene or protein identifier
interaction_typeNoType of interactions to retrieveall

Implementation Reference

  • src/index.ts:179-199 (registration)
    Registration of the 'get_interactions' MCP tool, including name, description, input schema, and inline handler function that delegates to WormBaseClient.
    server.tool( "get_interactions", "Get protein-protein, genetic, or regulatory interactions for a gene or protein.", { id: z.string().describe("Gene or protein identifier"), interaction_type: z.enum(["genetic", "physical", "regulatory", "all"]).optional().default("all").describe("Type of interactions to retrieve"), }, async ({ id, interaction_type }) => { try { const data = await client.getInteractions(id, interaction_type); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching interactions: ${error}` }], isError: true, }; } } );
  • Zod input schema for the tool parameters: id (required string) and optional interaction_type (enum).
    { id: z.string().describe("Gene or protein identifier"), interaction_type: z.enum(["genetic", "physical", "regulatory", "all"]).optional().default("all").describe("Type of interactions to retrieve"), },
  • The MCP tool handler function: calls client.getInteractions, returns JSON-formatted content or error response.
    async ({ id, interaction_type }) => { try { const data = await client.getInteractions(id, interaction_type); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching interactions: ${error}` }], isError: true, }; } }
  • Core helper method in WormBaseClient that fetches interactions from WormBase REST API, cleans the data using cleanWidgetData, and filters by interaction type if specified.
    async getInteractions( id: string, interactionType: string = "all" ): Promise<InteractionData> { const url = `${this.baseUrl}/rest/widget/gene/${encodeURIComponent(id)}/interactions`; const data = await this.fetch<any>(url); const interactions = this.cleanWidgetData(data); if (interactionType === "all") { return interactions as InteractionData; } // Filter by interaction type const filtered: Record<string, unknown> = {}; const interactionsObj = interactions as Record<string, unknown>; if (interactionType === "physical" && interactionsObj.physical) { filtered.physical = interactionsObj.physical; } if (interactionType === "genetic" && interactionsObj.genetic) { filtered.genetic = interactionsObj.genetic; } if (interactionType === "regulatory" && interactionsObj.regulatory) { filtered.regulatory = interactionsObj.regulatory; } return filtered as InteractionData; }
  • TypeScript interfaces defining Interaction and InteractionData (output structure with optional arrays for physical, genetic, regulatory interactions).
    export interface Interaction { interactor: EntityData; type: string; direction?: string; phenotype?: EntityData; citations?: EntityData[]; } export interface InteractionData { physical?: Interaction[]; genetic?: Interaction[]; regulatory?: Interaction[]; }

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