Skip to main content
Glama
mohammadnajeeb

NCBI Gene MCP Server

fetch_gene_info

Retrieve detailed gene information from NCBI using a specific gene ID to access metadata, descriptions, and related data for research and analysis.

Instructions

Fetch detailed information for a specific gene ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gene_idYesNCBI Gene ID (e.g., '672' for BRCA1)

Implementation Reference

  • Core implementation of fetch_gene_info: queries NCBI Entrez esummary API, parses response, constructs GeneInfo object.
    def fetch_gene_info(self, gene_id: str) -> GeneInfo:
        """
        Fetch detailed information for a specific gene.
        
        Args:
            gene_id: NCBI Gene ID
            
        Returns:
            GeneInfo object with gene details
        """
        params = {
            "db": "gene",
            "id": gene_id
        }
        
        response = self._make_request("esummary", params)
        
        result = response.get("result", {})
        gene_data = result.get(gene_id)
        
        if not gene_data:
            raise Exception(f"No data found for gene ID: {gene_id}")
        
        # Extract organism information
        organism = gene_data.get("organism", {})
        organism_name = organism.get("scientificname", "Unknown") if isinstance(organism, dict) else str(organism)
        
        # Extract other aliases
        other_aliases = []
        if "otheraliases" in gene_data:
            aliases = gene_data["otheraliases"]
            if isinstance(aliases, str):
                other_aliases = [alias.strip() for alias in aliases.split(",")]
            elif isinstance(aliases, list):
                other_aliases = aliases
        
        return GeneInfo(
            gene_id=gene_id,
            name=gene_data.get("name", ""),
            description=gene_data.get("description", ""),
            organism=organism_name,
            chromosome=gene_data.get("chromosome"),
            map_location=gene_data.get("maplocation"),
            gene_type=gene_data.get("geneticsource"),
            other_aliases=other_aliases if other_aliases else None,
            summary=gene_data.get("summary")
        )
  • MCP tool registration: defines name, description, and input schema for fetch_gene_info in tools/list response.
    {
        "name": "fetch_gene_info",
        "description": "Fetch detailed information for a specific gene ID",
        "inputSchema": {
            "type": "object",
            "properties": {
                "gene_id": {
                    "type": "string",
                    "description": "NCBI Gene ID (e.g., '672' for BRCA1)"
                }
            },
            "required": ["gene_id"]
        }
    },
  • MCP server dispatch handler for fetch_gene_info tool call: validates input, calls bridge, formats JSON response.
    elif name == "fetch_gene_info":
        gene_id = arguments.get("gene_id")
        if not gene_id:
            raise ValueError("gene_id is required")
        
        result = self.bridge.fetch_gene_info(gene_id)
        gene_json = result.model_dump_json(indent=2)
        self.send_response({
            "content": [{
                "type": "text", 
                "text": f"Gene Information for ID {gene_id}:\n\n{gene_json}"
            }]
        })
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool fetches 'detailed information' but doesn't specify what that includes (e.g., gene function, location, aliases), whether it's a read-only operation, potential rate limits, or error handling. This leaves significant gaps in understanding the tool's behavior.

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, clear sentence with no wasted words. It front-loads the key action and resource, making it easy to parse quickly, which is ideal for conciseness in tool descriptions.

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 is incomplete. It doesn't explain what 'detailed information' entails, how results are structured, or any behavioral traits like safety or performance. For a tool with no structured context, this leaves the agent under-informed about its operation and outputs.

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%, with the parameter 'gene_id' fully documented in the schema as an NCBI Gene ID with an example. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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 ('fetch') and resource ('detailed information for a specific gene ID'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings like 'fetch_protein_info' or 'search_by_gene_symbol', which likely retrieve related but distinct information.

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 like 'search_by_gene_symbol' or 'search_genes'. It mentions fetching by 'gene ID' but doesn't clarify if this is preferred over other identifiers or search methods, leaving the agent to infer usage context.

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/mohammadnajeeb/ncbi_gene_mcp_client'

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