get_go_term
Retrieve detailed information about a specific Gene Ontology term using its identifier to support ontology-based analysis and functional annotation research.
Instructions
Get detailed information for a specific GO term
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | GO term identifier (e.g., GO:0008150) |
Implementation Reference
- src/index.ts:431-493 (handler)The core handler function that implements the logic for the 'get_go_term' tool. It validates the input arguments, normalizes the GO term ID, queries the QuickGO API, processes the response data into a structured format, and returns the result as MCP content or an error response.private async handleGetGoTerm(args: any) { if (!isValidTermArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'GO term ID is required'); } try { const termId = this.normalizeGoId(args.id); const response = await this.quickGoClient.get(`/ontology/go/terms/${termId}`); const termInfo = response.data.results?.[0]; if (!termInfo) { return { content: [ { type: 'text', text: JSON.stringify({ error: `GO term not found: ${termId}`, suggestion: 'Check the GO ID format (e.g., GO:0008150) or search for the term first' }, null, 2), }, ], isError: true, }; } const detailedTerm = { id: termInfo.id, name: termInfo.name, definition: { text: termInfo.definition?.text || 'No definition available', references: termInfo.definition?.xrefs || [] }, namespace: termInfo.aspect === 'F' ? 'molecular_function' : termInfo.aspect === 'P' ? 'biological_process' : 'cellular_component', obsolete: termInfo.isObsolete || false, replaced_by: termInfo.replacedBy || [], consider: termInfo.consider || [], synonyms: termInfo.synonyms || [], xrefs: termInfo.xrefs || [], url: `https://www.ebi.ac.uk/QuickGO/term/${termInfo.id}`, amigo_url: `http://amigo.geneontology.org/amigo/term/${termInfo.id}` }; return { content: [ { type: 'text', text: JSON.stringify(detailedTerm, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching GO term: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:303-313 (registration)The tool registration entry in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'get_go_term'.{ name: 'get_go_term', description: 'Get detailed information for a specific GO term', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'GO term identifier (e.g., GO:0008150)' }, }, required: ['id'], }, },
- src/index.ts:84-91 (schema)Type guard function used to validate the input arguments for the 'get_go_term' tool, ensuring the required 'id' field is a non-empty string.const isValidTermArgs = (args: any): args is { id: string } => { return ( typeof args === 'object' && args !== null && typeof args.id === 'string' && args.id.length > 0 ); };
- src/index.ts:345-346 (registration)The switch case in the CallToolRequestSchema handler that routes calls to the 'get_go_term' tool to its handler function.case 'get_go_term': return this.handleGetGoTerm(args);
- src/index.ts:361-369 (helper)Helper function used by the handler to normalize GO term IDs, adding 'GO:' prefix if missing and the input matches 7 digits.private normalizeGoId(id: string): string { if (id.startsWith('GO:')) { return id; } if (/^\d{7}$/.test(id)) { return `GO:${id}`; } return id; }