Skip to main content
Glama
hlydecker
by hlydecker

get_track_data

Retrieve genomic track data from UCSC Genome Browser or custom hubs, with optional filtering by chromosome and coordinates for targeted analysis.

Instructions

Retrieve data from a specified track in a hub or UCSC database genome. Can be filtered by chromosome and coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genomeYesGenome assembly name
trackYesTrack name
chromNoChromosome name (optional)
startNoStart coordinate (0-based, optional, requires end)
endNoEnd coordinate (1-based, optional, requires start)
hub_urlNoURL of track/assembly hub (optional)
max_itemsNoMaximum number of items to return (default: 1000000)
json_output_arraysNoReturn data as JSON arrays instead of objects

Implementation Reference

  • Handler logic for the get_track_data tool: maps arguments to API parameters and calls the UCSC /getData/track endpoint via make_api_request.
    elif name == "get_track_data": params = { "genome": arguments["genome"], "track": arguments["track"], "chrom": arguments.get("chrom"), "start": arguments.get("start"), "end": arguments.get("end"), "hubUrl": arguments.get("hub_url"), "maxItemsOutput": arguments.get("max_items"), "jsonOutputArrays": 1 if arguments.get("json_output_arrays") else None } url = build_api_url("/getData/track", params) result = await make_api_request(url)
  • Input schema defining parameters for the get_track_data tool, including required genome and track, optional filters.
    inputSchema={ "type": "object", "properties": { "genome": { "type": "string", "description": "Genome assembly name" }, "track": { "type": "string", "description": "Track name" }, "chrom": { "type": "string", "description": "Chromosome name (optional)" }, "start": { "type": "integer", "description": "Start coordinate (0-based, optional, requires end)" }, "end": { "type": "integer", "description": "End coordinate (1-based, optional, requires start)" }, "hub_url": { "type": "string", "description": "URL of track/assembly hub (optional)" }, "max_items": { "type": "integer", "description": "Maximum number of items to return (default: 1000000)" }, "json_output_arrays": { "type": "boolean", "description": "Return data as JSON arrays instead of objects" } }, "required": ["genome", "track"] }
  • Registration of the get_track_data tool in the list_tools() function, specifying name, description, and input schema.
    Tool( name="get_track_data", description="Retrieve data from a specified track in a hub or UCSC database genome. Can be filtered by chromosome and coordinates.", inputSchema={ "type": "object", "properties": { "genome": { "type": "string", "description": "Genome assembly name" }, "track": { "type": "string", "description": "Track name" }, "chrom": { "type": "string", "description": "Chromosome name (optional)" }, "start": { "type": "integer", "description": "Start coordinate (0-based, optional, requires end)" }, "end": { "type": "integer", "description": "End coordinate (1-based, optional, requires start)" }, "hub_url": { "type": "string", "description": "URL of track/assembly hub (optional)" }, "max_items": { "type": "integer", "description": "Maximum number of items to return (default: 1000000)" }, "json_output_arrays": { "type": "boolean", "description": "Return data as JSON arrays instead of objects" } }, "required": ["genome", "track"] } ),
  • Helper function to construct UCSC API URLs from endpoint and parameters, used by get_track_data 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}"
  • Helper function to perform HTTP GET request to UCSC API and parse JSON response, used by get_track_data 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()

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