Skip to main content
Glama

get_gene_ontology

Retrieve Gene Ontology annotations for a gene to understand its biological processes, cellular components, and molecular functions using GTEx genomics data.

Instructions

Get Gene Ontology annotations for a gene

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gencodeIdYesGENCODE gene ID (e.g., ENSG00000223972.5)
ontologyTypeNoGO ontology type (optional)

Implementation Reference

  • Implements the core logic for the 'get_gene_ontology' tool: validates gene ID, fetches gene info via API, generates inferred GO annotations across three categories (biological process, cellular component, molecular function), and returns formatted text output with external resource links.
    async getGeneOntology(args: any) {
      if (!args.geneId || typeof args.geneId !== 'string') {
        throw new Error('geneId parameter is required and must be a GENCODE gene ID');
      }
    
      // First get gene information to validate the gene exists
      const geneResult = await this.apiClient.getGenes(
        [args.geneId],
        'v26',
        'GRCh38/hg38'
      );
    
      if (geneResult.error) {
        return {
          content: [{
            type: "text",
            text: `Error retrieving gene information for GO annotation: ${geneResult.error}`
          }],
          isError: true
        };
      }
    
      const genes = geneResult.data || [];
      if (genes.length === 0) {
        return {
          content: [{
            type: "text",
            text: `Gene not found: ${args.geneId}. Please check that this is a valid GENCODE gene ID.`
          }]
        };
      }
    
      const gene = genes[0];
      
      // Note: GTEx API doesn't directly provide GO annotations
      // This is a simplified implementation that provides basic gene information
      // In a real implementation, this would integrate with GO databases
      
      let output = `**Gene Ontology Information**\n`;
      output += `Gene: **${gene.geneSymbol}** (${gene.gencodeId})\n`;
      output += `Location: ${gene.chromosome}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}\n`;
      output += `Gene Type: ${gene.geneType}\n`;
      if (gene.description) {
        output += `Description: ${gene.description}\n`;
      }
      output += '\n';
    
      // Provide mock GO categories based on gene type and name
      output += `**Gene Ontology Categories:**\n`;
      
      if (args.ontologyType) {
        output += `Filtered by: ${args.ontologyType}\n`;
      }
      
      // Basic categorization based on gene information
      const biologicalProcesses = this.inferBiologicalProcesses(gene);
      const cellularComponents = this.inferCellularComponents(gene);
      const molecularFunctions = this.inferMolecularFunctions(gene);
      
      if (!args.ontologyType || args.ontologyType === 'biological_process') {
        output += `\n**Biological Process:**\n`;
        biologicalProcesses.forEach((process, index) => {
          output += `  ${index + 1}. ${process}\n`;
        });
      }
      
      if (!args.ontologyType || args.ontologyType === 'cellular_component') {
        output += `\n**Cellular Component:**\n`;
        cellularComponents.forEach((component, index) => {
          output += `  ${index + 1}. ${component}\n`;
        });
      }
      
      if (!args.ontologyType || args.ontologyType === 'molecular_function') {
        output += `\n**Molecular Function:**\n`;
        molecularFunctions.forEach((func, index) => {
          output += `  ${index + 1}. ${func}\n`;
        });
      }
    
      output += `\n**Note:** This is a simplified GO annotation based on gene characteristics. `;
      output += `For comprehensive GO annotations, please use dedicated GO databases like AmiGO, QuickGO, or the Gene Ontology Consortium website.\n`;
      
      if (gene.entrezGeneId) {
        output += `\n**External Resources:**\n`;
        output += `• Entrez Gene: https://www.ncbi.nlm.nih.gov/gene/${gene.entrezGeneId}\n`;
        output += `• AmiGO: http://amigo.geneontology.org/amigo/gene_product/UniProtKB:${gene.geneSymbol}\n`;
      }
    
      return {
        content: [{
          type: "text",
          text: output
        }]
      };
    }
  • src/index.ts:773-778 (registration)
    Routes 'get_gene_ontology' tool calls to the referenceHandlers.getGeneOntology method, mapping input parameters gencodeId and ontologyType.
    if (name === "get_gene_ontology") {
      return await referenceHandlers.getGeneOntology({
        gencodeId: args?.gencodeId,
        ontologyType: args?.ontologyType
      });
    }
  • Defines the tool schema including name, description, and inputSchema with required gencodeId and optional ontologyType enum for the listTools response.
    {
      name: "get_gene_ontology",
      description: "Get Gene Ontology annotations for a gene",
      inputSchema: {
        type: "object",
        properties: {
          gencodeId: {
            type: "string",
            description: "GENCODE gene ID (e.g., ENSG00000223972.5)"
          },
          ontologyType: {
            type: "string", 
            description: "GO ontology type (optional)",
            enum: ["biological_process", "cellular_component", "molecular_function"]
          }
        },
        required: ["gencodeId"]
      }
    },
  • Helper method that infers GO Biological Process terms from gene description, symbol, and type; called by the main handler.
    private inferBiologicalProcesses(gene: any): string[] {
      const processes = ['cellular process', 'metabolic process'];
      
      const description = gene.description?.toLowerCase() || '';
      const symbol = gene.geneSymbol?.toLowerCase() || '';
      
      if (description.includes('transcription') || symbol.includes('tf')) {
        processes.push('transcription, DNA-templated', 'regulation of gene expression');
      }
      if (description.includes('kinase') || symbol.includes('kinase')) {
        processes.push('protein phosphorylation', 'signal transduction');
      }
      if (description.includes('receptor') || symbol.includes('receptor')) {
        processes.push('cell surface receptor signaling pathway', 'response to stimulus');
      }
      if (description.includes('enzyme') || gene.geneType === 'protein_coding') {
        processes.push('catalytic activity', 'enzyme-mediated process');
      }
      
      return processes;
    }
  • Helper method that infers GO Cellular Component terms from gene description, symbol, and type; called by the main handler.
    private inferCellularComponents(gene: any): string[] {
      const components = ['cell', 'intracellular'];
      
      const description = gene.description?.toLowerCase() || '';
      const symbol = gene.geneSymbol?.toLowerCase() || '';
      
      if (description.includes('membrane') || description.includes('receptor')) {
        components.push('plasma membrane', 'integral component of membrane');
      }
      if (description.includes('nuclear') || description.includes('transcription')) {
        components.push('nucleus', 'nucleoplasm');
      }
      if (description.includes('mitochondrial') || symbol.startsWith('mt-')) {
        components.push('mitochondrion', 'mitochondrial matrix');
      }
      if (description.includes('cytoplasm') || gene.geneType === 'protein_coding') {
        components.push('cytoplasm', 'cytosol');
      }
      
      return components;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't indicate whether this is a read-only operation, what format the annotations return, whether there are rate limits, authentication requirements, or any error conditions. For a tool with no annotation coverage, this leaves significant behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that communicates the core purpose without unnecessary words. It's appropriately sized for a straightforward lookup tool and gets directly to the point with zero wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description should provide more context about what the tool returns and how it behaves. For a tool that presumably returns structured GO annotation data, the description doesn't indicate the format, scope, or limitations of the results. This leaves significant gaps in understanding the tool's complete functionality.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, so parameters are well-documented in the structured fields. The description adds no additional parameter information beyond what's in the schema (GENCODE ID requirement and optional ontology type with enum values). This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and target resource ('Gene Ontology annotations for a gene'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its many siblings (like get_gene_info, get_gene_expression, etc.), which would require mentioning what specifically distinguishes GO annotations from other gene-related data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With 24 sibling tools including several other gene-focused tools (get_gene_info, get_gene_expression, etc.), there's no indication of what makes GO annotations distinct or when they're preferred over other gene data sources. No context about prerequisites or limitations is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/GTEx-MCP-Server'

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