get_genes
Retrieve detailed information about cancer-related genes by providing Hugo symbols or Entrez IDs, enabling analysis of genomic data from cBioPortal studies.
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_ids | Yes | ||
| gene_id_type | No | ENTREZ_GENE_ID | |
| projection | No | SUMMARY |
Implementation Reference
- cbioportal_mcp/server.py:231-238 (handler)MCP tool handler for 'get_genes' that delegates execution 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)
- Core handler logic for fetching gene information via cBioPortal's batch genes/fetch API endpoint.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)}"}
- cbioportal_mcp/server.py:96-131 (registration)Registration of MCP tools including 'get_genes' via FastMCP.add_tool in the tool_methods list.def _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")