get_go_term
Retrieve detailed information for a specific Gene Ontology (GO) term using its identifier to support ontology-based analysis, gene annotation, and functional enrichment studies.
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)Executes the get_go_term tool: validates input, fetches detailed GO term data from QuickGO API, handles errors, and formats comprehensive term information including definition, namespace, synonyms, and links.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:304-313 (registration)Registers the get_go_term tool with the MCP server in the ListToolsRequestHandler, defining its name, description, and input schema.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 for validating input arguments to the get_go_term tool, ensuring 'id' 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:361-369 (helper)Utility function to normalize GO term IDs by adding 'GO:' prefix if missing or ensuring proper 7-digit format.private normalizeGoId(id: string): string { if (id.startsWith('GO:')) { return id; } if (/^\d{7}$/.test(id)) { return `GO:${id}`; } return id; }
- src/index.ts:345-346 (registration)Dispatch case in CallToolRequestHandler that routes get_go_term calls to the handler function.case 'get_go_term': return this.handleGetGoTerm(args);