Skip to main content
Glama
hlydecker

UCSC Genome Browser MCP Server

by hlydecker

list_files

Retrieve available download files for a specific UCSC genome assembly to access genomic data resources.

Instructions

List download files available for a specified UCSC genome assembly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genomeYesGenome assembly name (e.g., 'hg38', 'mm10')
formatNoOutput format (default: json)
max_itemsNoMaximum number of items to return

Implementation Reference

  • Handler implementation for the 'list_files' tool. Constructs parameters from input arguments and makes an API request to the UCSC Genome Browser's /list/files endpoint.
    elif name == "list_files":
        params = {
            "genome": arguments["genome"],
            "format": arguments.get("format"),
            "maxItemsOutput": arguments.get("max_items")
        }
        url = build_api_url("/list/files", params)
        result = await make_api_request(url)
  • Registration of the 'list_files' tool in the list_tools() function, including name, description, and input schema.
    Tool(
        name="list_files",
        description="List download files available for a specified UCSC genome assembly.",
        inputSchema={
            "type": "object",
            "properties": {
                "genome": {
                    "type": "string",
                    "description": "Genome assembly name (e.g., 'hg38', 'mm10')"
                },
                "format": {
                    "type": "string",
                    "enum": ["json", "text"],
                    "description": "Output format (default: json)"
                },
                "max_items": {
                    "type": "integer",
                    "description": "Maximum number of items to return"
                }
            },
            "required": ["genome"]
        }
    ),
  • Input schema definition for the 'list_files' tool, specifying parameters like genome (required), format, and max_items.
    inputSchema={
        "type": "object",
        "properties": {
            "genome": {
                "type": "string",
                "description": "Genome assembly name (e.g., 'hg38', 'mm10')"
            },
            "format": {
                "type": "string",
                "enum": ["json", "text"],
                "description": "Output format (default: json)"
            },
            "max_items": {
                "type": "integer",
                "description": "Maximum number of items to return"
            }
        },
        "required": ["genome"]
    }
  • Helper function build_api_url used by list_files handler to construct the API request URL.
    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}"
  • Helper function make_api_request used by list_files handler to perform the HTTP GET request and parse JSON.
    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()

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/hlydecker/ucsc-genome-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server