Skip to main content
Glama
WormBase

WormBase MCP Server

Official
by WormBase

get_ontology

Retrieve Gene Ontology annotations for a specific gene, including molecular function, biological process, and cellular component details from WormBase.

Instructions

Get Gene Ontology (GO) terms for a gene including molecular function, biological process, and cellular component annotations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesGene identifier

Implementation Reference

  • MCP tool handler for get_ontology: calls client.getOntology(id), returns JSON stringified data as text content or error response.
    async ({ id }) => {
      try {
        const data = await client.getOntology(id);
        return {
          content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error fetching ontology: ${error}` }],
          isError: true,
        };
      }
    }
  • Input schema for the get_ontology tool: requires a gene identifier string.
    {
      id: z.string().describe("Gene identifier"),
    },
  • src/index.ts:224-243 (registration)
    Registration of the get_ontology MCP tool using server.tool, including description, input schema, and handler function.
    server.tool(
      "get_ontology",
      "Get Gene Ontology (GO) terms for a gene including molecular function, biological process, and cellular component annotations.",
      {
        id: z.string().describe("Gene identifier"),
      },
      async ({ id }) => {
        try {
          const data = await client.getOntology(id);
          return {
            content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error fetching ontology: ${error}` }],
            isError: true,
          };
        }
      }
    );
  • Core helper function in WormBaseClient that performs the HTTP request to WormBase REST API for gene ontology data and processes it with cleanWidgetData.
    async getOntology(id: string): Promise<Record<string, unknown>> {
      const url = `${this.baseUrl}/rest/widget/gene/${encodeURIComponent(id)}/ontology`;
      const data = await this.fetch<any>(url);
      return this.cleanWidgetData(data);
    }

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