get_interactions
Retrieve protein-protein, genetic, or regulatory interactions for C. elegans genes or 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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Gene or protein identifier | |
| interaction_type | No | Type of interactions to retrieve | all |
Implementation Reference
- src/client.ts:137-164 (handler)Core handler function in WormBaseClient that fetches interaction data from the WormBase REST API widget endpoint, cleans the data using cleanWidgetData, and filters by interaction type (physical, genetic, regulatory, or all).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; }
- src/index.ts:179-199 (registration)MCP tool registration for 'get_interactions', including description, Zod input schema, and thin wrapper handler that calls WormBaseClient.getInteractions and returns JSON-formatted response.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, }; } } );
- src/index.ts:182-185 (schema)Zod schema for input parameters: 'id' (string, gene/protein ID) and 'interaction_type' (enum with default 'all').{ 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"), },
- src/types.ts:160-164 (schema)TypeScript interface defining the output structure for interaction data, with optional arrays for physical, genetic, and regulatory interactions.export interface InteractionData { physical?: Interaction[]; genetic?: Interaction[]; regulatory?: Interaction[]; }