Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesProtein identifier - WormBase protein ID
widgetsNoSpecific 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, }; } } );
  • 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, }; } }
  • 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"), },
  • 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; }
  • 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;

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