Skip to main content
Glama
pickleton89

cBioPortal MCP Server

by pickleton89

get_sample_list_id

Retrieve detailed sample list information for a specific cancer genomics study to access curated patient sample data for analysis.

Instructions

Get sample list information for a specific study and sample list ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
study_idYes
sample_list_idYes

Implementation Reference

  • Core handler implementing the tool logic: makes an API request to retrieve sample list details for the specified study_id and sample_list_id.
    @handle_api_errors("get sample list id")
    async def get_sample_list_id(self, study_id: str, sample_list_id: str) -> Dict:
        """
        Get sample list information for a specific study and sample list ID.
    
        Args:
            study_id: The ID of the cancer study
            sample_list_id: The ID of the sample list
    
        Returns:
            Dictionary containing sample list information
        """
        return await self.api_client.make_api_request(
            f"studies/{study_id}/sample_lists/{sample_list_id}"
        )
  • Registers all MCP tools, including 'get_sample_list_id', by adding the corresponding server 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")
  • Delegating handler on the main server class that is directly registered as the MCP tool and forwards the call to the SamplesEndpoints instance.
    async def get_sample_list_id(self, study_id: str, sample_list_id: str) -> Dict:
        """Get sample list information for a specific study and sample list ID."""
        return await self.samples.get_sample_list_id(study_id, sample_list_id)
  • Instantiation of the SamplesEndpoints class, which contains the primary implementation, injected with the API client.
    self.samples = SamplesEndpoints(self.api_client)
    self.molecular_profiles = MolecularProfilesEndpoints(self.api_client)

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