get_genes
Retrieve detailed information about specific genes using Hugo symbols or Entrez IDs through a batch endpoint on the cBioPortal MCP Server, supporting cancer genomics research.
Instructions
Get information about specific genes by their Hugo symbol or Entrez ID using batch endpoint.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gene_id_type | No | ENTREZ_GENE_ID | |
| gene_ids | Yes | ||
| projection | No | SUMMARY |
Implementation Reference
- cbioportal_mcp/server.py:96-131 (registration)Registers 'get_genes' (line 111) and other methods as MCP tools using FastMCP.add_tooldef _register_tools(self): """Register tool methods as MCP tools.""" # List of methods to register as tools (explicitly defined) tool_methods = [ # Pagination utilities "paginate_results", "collect_all_results", # Studies endpoints "get_cancer_studies", "get_cancer_types", "search_studies", "get_study_details", "get_multiple_studies", # Genes endpoints "search_genes", "get_genes", "get_multiple_genes", "get_mutations_in_gene", # Samples endpoints "get_samples_in_study", "get_sample_list_id", # Molecular profiles endpoints "get_molecular_profiles", "get_clinical_data", "get_gene_panels_for_study", "get_gene_panel_details", ] for method_name in tool_methods: if hasattr(self, method_name): method = getattr(self, method_name) self.mcp.add_tool(method) logger.debug(f"Registered tool: {method_name}") else: logger.warning(f"Method {method_name} not found for tool registration")
- cbioportal_mcp/server.py:231-238 (handler)The registered MCP tool handler for 'get_genes', which delegates to the GenesEndpoints implementation.async def get_genes( self, gene_ids: List[str], gene_id_type: str = "ENTREZ_GENE_ID", projection: str = "SUMMARY", ) -> Dict: """Get information about specific genes by their Hugo symbol or Entrez ID using batch endpoint.""" return await self.genes.get_genes(gene_ids, gene_id_type, projection)
- cbioportal_mcp/endpoints/genes.py:99-124 (handler)Core handler logic in GenesEndpoints class: performs the API POST request to 'genes/fetch' to retrieve batch gene information.@handle_api_errors("get genes") async def get_genes( self, gene_ids: List[str], gene_id_type: str = "ENTREZ_GENE_ID", projection: str = "SUMMARY", ) -> Dict: """ Get information about specific genes by their Hugo symbol or Entrez ID using batch endpoint. Args: gene_ids: List of gene IDs (Entrez IDs or Hugo symbols) gene_id_type: Type of gene ID provided (ENTREZ_GENE_ID or HUGO_GENE_SYMBOL) projection: Level of detail to return (ID, SUMMARY, DETAILED) Returns: Dictionary with gene information """ try: params = {"geneIdType": gene_id_type, "projection": projection} gene_data = await self.api_client.make_api_request( "genes/fetch", method="POST", params=params, json_data=gene_ids ) return {"genes": gene_data} except Exception as e: return {"error": f"Failed to get gene information: {str(e)}"}