Skip to main content
Glama
mohammadnajeeb

NCBI Gene MCP Server

search_by_gene_symbol

Search for genes by their symbol (like BRCA1 or TP53) with optional organism filtering to retrieve detailed information from NCBI databases.

Instructions

Search for genes by symbol with optional organism filter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesGene symbol (e.g., 'BRCA1', 'TP53')
organismNoOptional organism filter (e.g., 'human', 'Homo sapiens')

Implementation Reference

  • Registration of the 'search_by_gene_symbol' tool including its name, description, and input schema in the MCP server's tools list.
    {
        "name": "search_by_gene_symbol",
        "description": "Search for genes by symbol with optional organism filter",
        "inputSchema": {
            "type": "object",
            "properties": {
                "symbol": {
                    "type": "string",
                    "description": "Gene symbol (e.g., 'BRCA1', 'TP53')"
                },
                "organism": {
                    "type": "string",
                    "description": "Optional organism filter (e.g., 'human', 'Homo sapiens')"
                }
            },
            "required": ["symbol"]
        }
    }
  • MCP server handler for 'search_by_gene_symbol' tool: validates input, calls bridge method, formats and sends text response.
    elif name == "search_by_gene_symbol":
        symbol = arguments.get("symbol")
        organism = arguments.get("organism")
        if not symbol:
            raise ValueError("symbol is required")
        
        results = self.bridge.search_by_gene_symbol(symbol, organism)
        if not results:
            response_text = f"No genes found for symbol '{symbol}'"
            if organism:
                response_text += f" in organism '{organism}'"
        else:
            response_text = f"Found {len(results)} gene(s) for symbol '{symbol}'"
            if organism:
                response_text += f" in organism '{organism}'"
            response_text += ":\n\n"
            
            for i, gene in enumerate(results, 1):
                response_text += f"{i}. {gene.name} (ID: {gene.gene_id})\n"
                response_text += f"   Description: {gene.description}\n"
                response_text += f"   Organism: {gene.organism}\n"
                if gene.chromosome:
                    response_text += f"   Chromosome: {gene.chromosome}\n"
                response_text += "\n"
        
        self.send_response({
            "content": [{
                "type": "text", 
                "text": response_text
            }]
        })
  • Core implementation of search_by_gene_symbol: builds NCBI query, performs gene search, fetches detailed info for matching genes.
    def search_by_gene_symbol(self, symbol: str, organism: Optional[str] = None) -> List[GeneInfo]:
        """
        Search for genes by symbol and optionally filter by organism.
        
        Args:
            symbol: Gene symbol (e.g., "BRCA1")
            organism: Optional organism filter (e.g., "human", "Homo sapiens")
            
        Returns:
            List of GeneInfo objects
        """
        query = f"{symbol}[gene]"
        if organism:
            query += f" AND {organism}[organism]"
        
        search_result = self.search_genes(query, max_results=10)
        
        genes = []
        for gene_id in search_result.ids:
            try:
                gene_info = self.fetch_gene_info(gene_id)
                genes.append(gene_info)
            except Exception as e:
                # Skip genes that can't be fetched
                continue
        
        return genes
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 it's a search operation, implying read-only behavior, but doesn't detail aspects like response format, error handling, rate limits, or whether it returns partial matches. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 concise and front-loaded in a single sentence, efficiently conveying the core function without unnecessary details. However, it could be slightly improved by structuring to highlight key points more clearly, but it avoids waste and is appropriately sized for the tool's complexity.

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

Completeness3/5

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

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and parameters but lacks details on output, error cases, and differentiation from siblings. Without an output schema, more information on return values would be helpful, making it minimally viable but with clear gaps.

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 input schema already documents both parameters ('symbol' and 'organism') with descriptions. The description adds marginal value by emphasizing the optionality of 'organism' but doesn't provide additional semantics beyond what the schema offers, such as format examples or constraints. Baseline 3 is appropriate when the schema handles most documentation.

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 tool's purpose: 'Search for genes by symbol with optional organism filter.' It specifies the verb ('Search'), resource ('genes'), and key parameter ('symbol'), making the function evident. However, it doesn't explicitly differentiate from sibling tools like 'search_genes' or 'fetch_gene_info,' which might offer similar functionality, so it doesn't reach the highest score.

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 minimal guidance, mentioning an 'optional organism filter' but not explaining when to use this tool versus alternatives like 'search_genes' or 'fetch_gene_info.' There's no context on when this tool is preferred, what it returns, or any prerequisites, leaving usage unclear in relation to siblings.

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