Skip to main content
Glama
pickleton89

cBioPortal MCP Server

by pickleton89

get_study_details

Retrieve comprehensive information about a specific cancer genomics study, including details on genomic data, mutations, and clinical information from cBioPortal.

Instructions

Get detailed information for a specific cancer study.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
study_idYes

Implementation Reference

  • Core handler function that performs input validation, makes the API request to fetch study details from 'studies/{study_id}', and handles errors.
    @handle_api_errors("get study details")
    async def get_study_details(self, study_id: str) -> Dict[str, Any]:
        """
        Get detailed information for a specific cancer study.
    
        Args:
            study_id: The ID of the cancer study
    
        Returns:
            Dictionary containing study details
        """
        # Input Validation
        validate_study_id(study_id)
    
        endpoint = f"studies/{study_id}"
        try:
            study = await self.api_client.make_api_request(endpoint)
            return {"study": study}
        except Exception as e:
            return {"error": f"Failed to get study details for {study_id}: {str(e)}"}
  • Proxy handler method on the main server class that delegates to the StudiesEndpoints implementation; this is the method registered as the MCP tool.
    async def get_study_details(self, study_id: str) -> Dict[str, Any]:
        """Get detailed information for a specific cancer study."""
        return await self.studies.get_study_details(study_id)
  • Registers all MCP tools, including 'get_study_details', by dynamically adding the server instance methods to FastMCP.
    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")
  • Input validation function for the study_id parameter, ensuring it is a non-empty string. Called within the handler.
    def validate_study_id(study_id: str) -> None:
        """
        Validate study ID parameter.
    
        Args:
            study_id: Study identifier
    
        Raises:
            TypeError: If study_id is not a string
            ValueError: If study_id is empty
        """
        if not isinstance(study_id, str):
            raise TypeError("study_id must be a string")
        if not study_id:
            raise ValueError("study_id cannot be empty")

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/pickleton89/cbioportal-mcp'

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