Skip to main content
Glama
Augmented-Nature

GeneOntology MCP Server

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
NameRequiredDescriptionDefault
idYesGO term identifier (e.g., GO:0008150)

Implementation Reference

  • 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'],
      },
    },
  • 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);
  • 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;
    }

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/Augmented-Nature/GeneOntology-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server