list_datasets
Retrieve a CSV-formatted list of all available datasets in a specified Biomart mart, including display names and descriptions, to simplify dataset discovery and selection.
Instructions
Lists all available biomart datasets for a given mart.
Each mart contains multiple datasets. This function returns all datasets
available in the specified mart as a CSV string.
Args:
mart (str): The mart identifier to list datasets from.
Valid values include: ENSEMBL_MART_ENSEMBL, ENSEMBL_MART_MOUSE,
ENSEMBL_MART_ONTOLOGY, ENSEMBL_MART_GENOMIC, ENSEMBL_MART_SNP,
ENSEMBL_MART_FUNCGEN
Returns:
str: CSV-formatted table of all datasets with their display names and descriptions.
Example:
list_datasets("ENSEMBL_MART_ENSEMBL")
>>> "name,display_name,description
hsapiens_gene_ensembl,Human genes,Human genes (GRCh38.p13)
mmusculus_gene_ensembl,Mouse genes,Mouse genes (GRCm39)
..."
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mart | Yes |
Implementation Reference
- biomart-mcp.py:88-117 (handler)The handler function for the 'list_datasets' tool. It is decorated with @mcp.tool(), takes a 'mart' parameter, retrieves the Biomart server, lists datasets for the given mart, and returns the result as a CSV string with error handling.@mcp.tool() def list_datasets(mart: str): """ Lists all available biomart datasets for a given mart. Each mart contains multiple datasets. This function returns all datasets available in the specified mart as a CSV string. Args: mart (str): The mart identifier to list datasets from. Valid values include: ENSEMBL_MART_ENSEMBL, ENSEMBL_MART_MOUSE, ENSEMBL_MART_ONTOLOGY, ENSEMBL_MART_GENOMIC, ENSEMBL_MART_SNP, ENSEMBL_MART_FUNCGEN Returns: str: CSV-formatted table of all datasets with their display names and descriptions. Example: list_datasets("ENSEMBL_MART_ENSEMBL") >>> "name,display_name,description hsapiens_gene_ensembl,Human genes,Human genes (GRCh38.p13) mmusculus_gene_ensembl,Mouse genes,Mouse genes (GRCm39) ..." """ try: server = get_server() return server[mart].list_datasets().to_csv(index=False).replace("\r", "") except Exception as e: print(f"Error listing datasets for mart {mart}: {str(e)}", file=sys.stderr) return f"Error: {str(e)}"