list_chromosomes
Retrieve chromosome lists from UCSC Genome Browser assemblies, hubs, or databases to identify available genomic sequences for analysis.
Instructions
List chromosomes in an assembly hub, track hub, or UCSC database genome. Optionally filter by specific track.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| genome | Yes | Genome assembly name | |
| hub_url | No | URL of track/assembly hub (optional) | |
| track | No | Specific track name to list chromosomes from (optional) |
Implementation Reference
- ucsc-genome-mcp.py:189-210 (registration)Registration of the 'list_chromosomes' tool, including its description and input schema.Tool( name="list_chromosomes", description="List chromosomes in an assembly hub, track hub, or UCSC database genome. Optionally filter by specific track.", inputSchema={ "type": "object", "properties": { "genome": { "type": "string", "description": "Genome assembly name" }, "hub_url": { "type": "string", "description": "URL of track/assembly hub (optional)" }, "track": { "type": "string", "description": "Specific track name to list chromosomes from (optional)" } }, "required": ["genome"] } ),
- ucsc-genome-mcp.py:393-400 (handler)Handler implementation for 'list_chromosomes' tool. Constructs parameters from arguments and makes an API request to the UCSC Genome Browser's /list/chromosomes endpoint.elif name == "list_chromosomes": params = { "genome": arguments["genome"], "hubUrl": arguments.get("hub_url"), "track": arguments.get("track") } url = build_api_url("/list/chromosomes", params) result = await make_api_request(url)
- ucsc-genome-mcp.py:27-37 (helper)Helper function to build the UCSC API URL used by the list_chromosomes handler.def build_api_url(endpoint: str, params: dict[str, Any]) -> str: """Build the complete API URL with parameters.""" # Filter out None values filtered_params = {k: v for k, v in params.items() if v is not None} # Convert parameters to URL format (using semicolons as per UCSC API spec) if filtered_params: param_str = ";".join(f"{k}={v}" for k, v in filtered_params.items()) return f"{BASE_URL}{endpoint}?{param_str}" return f"{BASE_URL}{endpoint}"
- ucsc-genome-mcp.py:39-45 (helper)Helper function to perform HTTP requests to UCSC API, used by the list_chromosomes handler.async def make_api_request(url: str) -> dict[str, Any]: """Make an HTTP request to the UCSC API and return JSON response.""" async with httpx.AsyncClient(timeout=30.0) as client: response = await client.get(url) response.raise_for_status() return response.json()