Skip to main content
Glama
pickleton89

cBioPortal MCP Server

by pickleton89

collect_all_results

Retrieve complete paginated results from cBioPortal cancer genomics endpoints to access comprehensive mutation and clinical data.

Instructions

Delegate to utils.pagination.collect_all_results with api_client.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYes
paramsNo
methodNoGET
json_dataNo
max_pagesNo
limitNo

Implementation Reference

  • MCP tool handler for collect_all_results tool. Thin wrapper that injects the API client and delegates to the pagination utility.
    async def collect_all_results( self, endpoint: str, params: Optional[Dict[str, Any]] = None, method: str = "GET", json_data: Any = None, max_pages: Optional[int] = None, limit: Optional[int] = None, ) -> List[Dict[str, Any]]: """Delegate to utils.pagination.collect_all_results with api_client.""" return await collect_all_results( self.api_client, endpoint, params, method, json_data, max_pages, limit )
  • Core utility implementation of collect_all_results. Uses paginate_results async generator to fetch and accumulate all pages of results, respecting limits.
    async def collect_all_results( api_client, endpoint: str, params: Optional[Dict[str, Any]] = None, method: str = "GET", json_data: Any = None, max_pages: Optional[int] = None, limit: Optional[int] = None, ) -> List[Dict[str, Any]]: """ Collect all results from a paginated endpoint into a single list. Args: api_client: The APIClient instance to use for requests endpoint: API endpoint path params: Query parameters to include in the request method: HTTP method (GET or POST) json_data: JSON data for POST requests max_pages: Maximum number of pages to retrieve limit: Maximum number of total results to return Returns: List of all collected results (limited by max_pages and/or limit) """ all_results = [] async for page in paginate_results( api_client, endpoint, params, method, json_data, max_pages ): all_results.extend(page) # Stop if we've reached the specified limit if limit and len(all_results) >= limit: all_results = all_results[:limit] break return all_results
  • Registration of MCP tools including collect_all_results. The tool_methods list includes it, and self.mcp.add_tool registers the handler method.
    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")

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