Skip to main content
Glama
WormBase

WormBase MCP Server

Official
by WormBase

get_paper

Retrieve scientific paper details including authors, abstract, and associated genes using WormBase or PubMed identifiers.

Instructions

Get information about a scientific paper/publication including authors, abstract, and associated genes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPaper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID

Implementation Reference

  • The handler function for the 'get_paper' tool. It invokes WormBaseClient.getEntity with type 'paper' and specific widgets ['overview', 'referenced_genes'], formats the result as JSON text, and handles errors.
    async ({ id }) => {
      try {
        const data = await client.getEntity("paper", id, ["overview", "referenced_genes"]);
        return {
          content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error fetching paper: ${error}` }],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the 'get_paper' tool: a required string 'id' for the paper identifier.
    {
      id: z.string().describe("Paper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID"),
    },
  • src/index.ts:270-289 (registration)
    MCP tool registration for 'get_paper' using McpServer.tool(), specifying name, description, input schema, and handler.
    server.tool(
      "get_paper",
      "Get information about a scientific paper/publication including authors, abstract, and associated genes.",
      {
        id: z.string().describe("Paper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID"),
      },
      async ({ id }) => {
        try {
          const data = await client.getEntity("paper", id, ["overview", "referenced_genes"]);
          return {
            content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error fetching paper: ${error}` }],
            isError: true,
          };
        }
      }
    );
  • WormBaseClient.getEntity method: generic implementation to fetch data for any WormBase entity type (including 'paper') by querying REST API widgets and cleaning the response.
    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