Skip to main content
Glama
pickleton89

cBioPortal MCP Server

by pickleton89

get_cancer_studies

Retrieve and paginate through cancer studies in cBioPortal, enabling users to explore and analyze genomic data with customizable sorting and filtering options.

Instructions

Get a list of cancer studies in cBioPortal with pagination support.

Input Schema

NameRequiredDescriptionDefault
directionNoASC
limitNo
page_numberNo
page_sizeNo
sort_byNo

Input Schema (JSON Schema)

{ "additionalProperties": false, "properties": { "direction": { "default": "ASC", "title": "Direction", "type": "string" }, "limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Limit" }, "page_number": { "default": 0, "title": "Page Number", "type": "integer" }, "page_size": { "default": 50, "title": "Page Size", "type": "integer" }, "sort_by": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Sort By" } }, "type": "object" }

Implementation Reference

  • Primary handler implementing the tool logic: performs a paginated GET request to the cBioPortal 'studies' endpoint using the inherited paginated_request method.
    @handle_api_errors("get cancer studies") @validate_paginated_params async def get_cancer_studies( self, page_number: int = 0, page_size: int = 50, sort_by: Optional[str] = None, direction: str = "ASC", limit: Optional[int] = None, ) -> Dict[str, Any]: """ Get a list of cancer studies in cBioPortal with pagination support. Args: page_number: Page number to retrieve (0-based) page_size: Number of items per page sort_by: Field to sort by direction: Sort direction (ASC or DESC) limit: Maximum number of items to return across all pages (None for no limit) Returns: Dictionary containing list of studies and metadata """ return await self.paginated_request( endpoint="studies", page_number=page_number, page_size=page_size, sort_by=sort_by, direction=direction, limit=limit, data_key="studies" )
  • Registers 'get_cancer_studies' (and other methods) as MCP tools by calling self.mcp.add_tool on the server instance methods.
    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")
  • Thin wrapper method on the server instance that delegates to StudiesEndpoints.get_cancer_studies; this is the method directly registered as the MCP tool.
    async def get_cancer_studies( self, page_number: int = 0, page_size: int = 50, sort_by: Optional[str] = None, direction: str = "ASC", limit: Optional[int] = None, ) -> Dict[str, Any]: """Get a list of cancer studies in cBioPortal with pagination support.""" return await self.studies.get_cancer_studies( page_number, page_size, sort_by, direction, limit )
  • Instantiates the StudiesEndpoints instance (self.studies) with the API client, enabling delegation to study-specific handlers.
    self.studies = StudiesEndpoints(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