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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Gene identifier |
Implementation Reference
- src/index.ts:230-242 (handler)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, }; } }
- src/index.ts:227-229 (schema)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, }; } } );
- src/client.ts:178-182 (helper)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); }