get_protein
Retrieve detailed protein information including sequence, domains, motifs, and structure from the WormBase database for C. elegans research.
Instructions
Get detailed information about a protein including sequence, domains, motifs, and structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Protein identifier - WormBase protein ID | |
| widgets | No | Specific widgets to fetch: overview, sequences, motif_details, external_links, references |
Implementation Reference
- src/index.ts:64-84 (registration)MCP server.tool registration for 'get_protein', including tool description, Zod input schema for protein ID and optional widgets, and inline async handler that fetches data via WormBaseClient and returns JSON-formatted response or error.server.tool( "get_protein", "Get detailed information about a protein including sequence, domains, motifs, and structure.", { id: z.string().describe("Protein identifier - WormBase protein ID"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, sequences, motif_details, external_links, references"), }, async ({ id, widgets }) => { try { const data = await client.getEntity("protein", id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching protein: ${error}` }], isError: true, }; } } );
- src/index.ts:71-83 (handler)Inline handler function executing the core logic of the get_protein tool: retrieves protein entity data using client.getEntity with type 'protein', stringifies to JSON, handles errors.async ({ id, widgets }) => { try { const data = await client.getEntity("protein", id, widgets); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching protein: ${error}` }], isError: true, }; } }
- src/index.ts:67-70 (schema)Zod schema for get_protein tool inputs: required 'id' string (WormBase protein ID), optional 'widgets' array specifying data sections like sequences, motifs.{ id: z.string().describe("Protein identifier - WormBase protein ID"), widgets: z.array(z.string()).optional().describe("Specific widgets to fetch: overview, sequences, motif_details, external_links, references"), },
- src/client.ts:111-132 (helper)WormBaseClient.getEntity helper method called by get_protein handler; fetches specified widgets from WormBase REST API for any entity type (hardcoded 'protein' in handler), cleans 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; }
- src/types.ts:69-75 (schema)TypeScript const array defining available widgets specifically for protein entities, referenced in the tool's schema description.export const PROTEIN_WIDGETS = [ ...COMMON_WIDGETS, "sequences", "motif_details", "homology", "blast_details", ] as const;