Skip to main content
Glama
hlydecker

UCSC Genome Browser MCP Server

by hlydecker

get_sequence

Retrieve DNA sequences from genome assemblies using chromosome coordinates. Specify genome, chromosome, and optional start/end positions to extract specific genomic regions.

Instructions

Retrieve DNA sequence from a specified genome assembly. Can retrieve entire chromosome or specific coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genomeYesGenome assembly name (e.g., 'hg38')
chromYesChromosome name (e.g., 'chr1', 'chrM')
startNoStart coordinate (0-based, optional, requires end)
endNoEnd coordinate (1-based, optional, requires start)
hub_urlNoURL of assembly hub (optional)
reverse_complementNoReturn reverse complement of sequence

Implementation Reference

  • The execution handler for the get_sequence tool. It extracts parameters from the tool arguments, builds the UCSC API URL for the /getData/sequence endpoint, and fetches the DNA sequence data.
    elif name == "get_sequence":
        params = {
            "genome": arguments["genome"],
            "chrom": arguments["chrom"],
            "start": arguments.get("start"),
            "end": arguments.get("end"),
            "hubUrl": arguments.get("hub_url"),
            "revComp": 1 if arguments.get("reverse_complement") else None
        }
        url = build_api_url("/getData/sequence", params)
        result = await make_api_request(url)
  • The registration of the get_sequence tool in the list_tools() function, defining its name, description, and input schema for MCP.
    Tool(
        name="get_sequence",
        description="Retrieve DNA sequence from a specified genome assembly. Can retrieve entire chromosome or specific coordinates.",
        inputSchema={
            "type": "object",
            "properties": {
                "genome": {
                    "type": "string",
                    "description": "Genome assembly name (e.g., 'hg38')"
                },
                "chrom": {
                    "type": "string",
                    "description": "Chromosome name (e.g., 'chr1', 'chrM')"
                },
                "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 assembly hub (optional)"
                },
                "reverse_complement": {
                    "type": "boolean",
                    "description": "Return reverse complement of sequence"
                }
            },
            "required": ["genome", "chrom"]
        }
    ),
  • The input schema definition for the get_sequence tool, specifying parameters like genome, chrom, start, end, etc.
    inputSchema={
        "type": "object",
        "properties": {
            "genome": {
                "type": "string",
                "description": "Genome assembly name (e.g., 'hg38')"
            },
            "chrom": {
                "type": "string",
                "description": "Chromosome name (e.g., 'chr1', 'chrM')"
            },
            "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 assembly hub (optional)"
            },
            "reverse_complement": {
                "type": "boolean",
                "description": "Return reverse complement of sequence"
            }
        },
        "required": ["genome", "chrom"]
    }
  • Helper function build_api_url used by get_sequence handler to construct the UCSC API request URL with semicolon-separated parameters.
    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 get_sequence handler to perform the asynchronous HTTP GET request to the UCSC API and parse JSON response.
    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()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool can retrieve sequences but doesn't disclose critical traits: whether it's read-only (implied by 'retrieve' but not explicit), potential rate limits, authentication needs, error handling, or output format. For a tool with 6 parameters and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: a single sentence states the core purpose, followed by a second sentence clarifying scope. Every sentence earns its place by adding value (e.g., distinguishing between entire chromosome and coordinate-based retrieval). There's no wasted verbiage or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 parameters, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose and scope but lacks details on behavioral traits, output format, or error conditions. For a retrieval tool with multiple parameters, more context would be helpful, but it meets the minimum viable threshold.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema: it implies that 'start' and 'end' are for specific coordinates, but this is already clear in the schema descriptions. With high schema coverage, the baseline is 3, and the description doesn't significantly enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Retrieve DNA sequence from a specified genome assembly.' It specifies the resource (DNA sequence) and the action (retrieve), and distinguishes it from siblings like 'find_genome' or 'list_chromosomes' by focusing on sequence retrieval rather than metadata listing. However, it doesn't explicitly differentiate from 'get_track_data' which might also retrieve genomic data, so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some implied usage guidance: it mentions retrieving 'entire chromosome or specific coordinates,' which suggests when to use optional parameters. However, it doesn't explicitly state when to use this tool versus alternatives like 'search_genome' or 'get_track_data,' nor does it provide exclusions or prerequisites. The guidance is functional but not comprehensive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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