Skip to main content
Glama

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

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