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')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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:
Behavior4/5

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

With no annotations provided, the description carries the full burden. It effectively discloses key behavioral traits: it's a read operation ('fetches'), provides real-time/current data, and specifies the data source (MyGene.info). It doesn't mention rate limits, authentication needs, or error handling, but covers the core functionality well for a query tool.

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

Conciseness4/5

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

The description is well-structured with clear sections (prerequisite, what it provides, data currency, examples, alternatives). While slightly longer than minimal, every sentence adds value. The warning icon and bullet points enhance readability without unnecessary verbosity.

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

Completeness5/5

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

For a single-parameter query tool with an output schema (which handles return values), the description is complete. It covers purpose, usage guidelines, behavioral context, and distinguishes from siblings. The presence of an output schema means the description doesn't need to explain return values.

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?

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description doesn't add any parameter-specific information beyond what's in the schema (both mention gene symbols and IDs). Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Get detailed gene information from MyGene.info' with specific examples of what information is provided (gene name, symbol, summary, aliases, type, links). It distinguishes itself from sibling tools like variant_searcher and article_searcher by focusing on gene annotations rather than variants or articles.

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

Usage Guidelines5/5

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

The description provides explicit guidance: it includes a prerequisite ('Use the 'think' tool FIRST'), gives positive examples of when to use it (e.g., 'Get information about TP53'), and explicitly names alternatives for related tasks ('For genetic variants, use variant_searcher. For articles about genes, use article_searcher').

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

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

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