Skip to main content
Glama

gene_getter

Retrieve detailed gene annotations, including names, summaries, aliases, types, and database links from MyGene.info. Use for accurate, real-time gene information on symbols or IDs like TP53 or BRAF.

Instructions

Get detailed gene information from MyGene.info.

⚠️ PREREQUISITE: Use the 'think' tool FIRST to understand your research goal! Provides real-time gene annotations including: - Official gene name and symbol - Gene summary/description - Aliases and alternative names - Gene type (protein-coding, etc.) - Links to external databases This tool fetches CURRENT gene information from MyGene.info, ensuring you always have the latest annotations and nomenclature. Example usage: - Get information about TP53 tumor suppressor - Look up BRAF kinase gene details - Find the official name for a gene by its alias Note: For genetic variants, use variant_searcher. For articles about genes, use article_searcher.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_id_or_symbolYesGene symbol (e.g., 'TP53', 'BRAF') or Entrez ID (e.g., '7157')

Implementation Reference

  • The primary handler function for the 'gene_getter' MCP tool. Registered via @mcp_app.tool() decorator. Includes schema via Annotated Field and executes by delegating to _gene_details.
    @mcp_app.tool() @track_performance("biomcp.gene_getter") async def gene_getter( gene_id_or_symbol: Annotated[ str, Field( description="Gene symbol (e.g., 'TP53', 'BRAF') or Entrez ID (e.g., '7157')" ), ], ) -> str: """Get detailed gene information from MyGene.info. ⚠️ PREREQUISITE: Use the 'think' tool FIRST to understand your research goal! Provides real-time gene annotations including: - Official gene name and symbol - Gene summary/description - Aliases and alternative names - Gene type (protein-coding, etc.) - Links to external databases This tool fetches CURRENT gene information from MyGene.info, ensuring you always have the latest annotations and nomenclature. Example usage: - Get information about TP53 tumor suppressor - Look up BRAF kinase gene details - Find the official name for a gene by its alias Note: For genetic variants, use variant_searcher. For articles about genes, use article_searcher. """ return await _gene_details( call_benefit="Get up-to-date gene annotations and information", gene_id_or_symbol=gene_id_or_symbol, ) # Disease Tools
  • Core helper function implementing the gene fetching logic from MyGene.info via BioThingsClient, formatting as markdown or JSON.
    async def get_gene( gene_id_or_symbol: str, output_json: bool = False, ) -> str: """ Get gene information from MyGene.info. Args: gene_id_or_symbol: Gene ID (Entrez, Ensembl) or symbol (e.g., "TP53", "7157") output_json: Return as JSON instead of markdown Returns: Gene information as markdown or JSON string """ client = BioThingsClient() try: gene_info = await client.get_gene_info(gene_id_or_symbol) if not gene_info: error_data = { "error": f"Gene '{gene_id_or_symbol}' not found", "suggestion": "Please check the gene symbol or ID", } return ( json.dumps(error_data, indent=2) if output_json else to_markdown([error_data]) ) # Convert to dict for rendering result = gene_info.model_dump(exclude_none=True) # Add helpful links if gene_info.entrezgene: result["_links"] = { "NCBI Gene": f"https://www.ncbi.nlm.nih.gov/gene/{gene_info.entrezgene}", "PubMed": f"https://pubmed.ncbi.nlm.nih.gov/?term={gene_info.symbol}", } # Format aliases nicely if gene_info.alias: result["alias"] = ", ".join( gene_info.alias[:10] ) # Limit to first 10 if len(gene_info.alias) > 10: result["alias"] += f" (and {len(gene_info.alias) - 10} more)" if output_json: return json.dumps(result, indent=2) else: return to_markdown([result]) except Exception as e: logger.error(f"Error fetching gene info for {gene_id_or_symbol}: {e}") error_data = { "error": "Failed to retrieve gene information", "details": str(e), } return ( json.dumps(error_data, indent=2) if output_json else to_markdown([error_data]) )
  • Intermediate helper wrapper called by the handler, delegates to get_gene with markdown output.
    async def _gene_details( call_benefit: Annotated[ str, "Define and summarize why this function is being called and the intended benefit", ], gene_id_or_symbol: Annotated[ str, Field(description="Gene symbol (e.g., TP53, BRAF) or ID (e.g., 7157)"), ], ) -> str: """ Retrieves detailed information for a single gene from MyGene.info. This tool provides real-time gene annotations including: - Official gene name and symbol - Gene summary/description - Aliases and alternative names - Gene type (protein-coding, etc.) - Links to external databases Parameters: - call_benefit: Define why this function is being called - gene_id_or_symbol: Gene symbol (e.g., "TP53") or Entrez ID (e.g., "7157") Process: Queries MyGene.info API for up-to-date gene annotations Output: Markdown formatted gene information with description and metadata Note: For variant information, use variant_searcher. For articles about genes, use article_searcher. """ return await get_gene(gene_id_or_symbol, output_json=False)
  • Registration decorators for the gene_getter tool in the MCP app.
    @mcp_app.tool() @track_performance("biomcp.gene_getter")
  • Pydantic schema definition for the tool input parameter via Annotated Field.
    gene_id_or_symbol: Annotated[ str, Field( description="Gene symbol (e.g., 'TP53', 'BRAF') or Entrez ID (e.g., '7157')" ), ], ) -> str:

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/genomoncology/biomcp'

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