list_common_attributes
Retrieve commonly used attributes for a specific dataset from BioMart databases. Streamlines dataset exploration by providing essential attributes in a CSV format for easy analysis and integration.
Instructions
Lists commonly used attributes available for a given dataset.
This function returns only the most frequently used attributes (defined in COMMON_ATTRIBUTES)
to avoid overwhelming the model with too many options. For a complete list,
use list_all_attributes.
Args:
mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL")
dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl")
Returns:
str: CSV-formatted table of common attributes with their display names and descriptions.
Example:
list_common_attributes("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl")
>>> "name,display_name,description
ensembl_gene_id,Gene stable ID,Ensembl stable ID for the gene
external_gene_name,Gene name,The gene name
..."
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dataset | Yes | ||
| mart | Yes |
Implementation Reference
- biomart-mcp.py:120-146 (handler)The handler function for the 'list_common_attributes' tool. It connects to the Biomart server, lists all attributes for the dataset, filters to common ones defined in COMMON_ATTRIBUTES, and returns as CSV.@mcp.tool() def list_common_attributes(mart: str, dataset: str): """ Lists commonly used attributes available for a given dataset. This function returns only the most frequently used attributes (defined in COMMON_ATTRIBUTES) to avoid overwhelming the model with too many options. For a complete list, use list_all_attributes. Args: mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL") dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl") Returns: str: CSV-formatted table of common attributes with their display names and descriptions. Example: list_common_attributes("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl") >>> "name,display_name,description ensembl_gene_id,Gene stable ID,Ensembl stable ID for the gene external_gene_name,Gene name,The gene name ..." """ server = pybiomart.Server(host=DEFAULT_HOST) df = server[mart][dataset].list_attributes() df = df[df["name"].isin(COMMON_ATTRIBUTES)] return df.to_csv(index=False).replace("\r", "")
- biomart-mcp.py:120-120 (registration)The @mcp.tool() decorator registers the list_common_attributes function as an MCP tool.@mcp.tool()
- biomart-mcp.py:28-47 (helper)Predefined list of common attributes used by the list_common_attributes handler to filter the full attribute list.COMMON_ATTRIBUTES = [ "ensembl_gene_id", "external_gene_name", "hgnc_symbol", "hgnc_id", "gene_biotype", "ensembl_transcript_id", "ensembl_peptide_id", "ensembl_exon_id", "description", "chromosome_name", "start_position", "end_position", "strand", "band", "transcript_start", "transcript_end", "transcription_start_site", "transcript_length", ]
- biomart-mcp.py:121-121 (schema)Function signature defining input parameters with type annotations, which serves as the input schema for the tool.def list_common_attributes(mart: str, dataset: str):