Skip to main content
Glama
seayniclabs

Keel

by seayniclabs

speed_test

Measures network download speed and latency using a 10 MB test payload and TCP connect pings.

Instructions

Measure network download speed and latency.

Downloads a 10 MB test payload from Cloudflare and measures throughput. Also measures latency with multiple TCP connect pings. Returns download speed in Mbps and latency stats in milliseconds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the speed_test tool. Downloads a 10 MB test payload from Cloudflare, measures throughput (Mbps) and TCP connect latency (ms). Returns a dict with test_server, latency stats (min/avg/max ms), and download info (speed_mbps, bytes_transferred, duration_ms).
    @mcp.tool()
    async def speed_test() -> dict:
        """Measure network download speed and latency.
    
        Downloads a 10 MB test payload from Cloudflare and measures throughput.
        Also measures latency with multiple TCP connect pings.
        Returns download speed in Mbps and latency stats in milliseconds.
        """
        # ── Latency measurement (5 TCP pings to Cloudflare) ──
        latencies: list[float] = []
        for _ in range(5):
            start = time.perf_counter()
            try:
                reader, writer = await asyncio.wait_for(
                    asyncio.open_connection("speed.cloudflare.com", 443),
                    timeout=5,
                )
                elapsed = (time.perf_counter() - start) * 1000
                latencies.append(elapsed)
                writer.close()
                await writer.wait_closed()
            except (OSError, asyncio.TimeoutError):
                pass
    
        latency_stats: dict = {}
        if latencies:
            avg = sum(latencies) / len(latencies)
            latency_stats = {
                "min_ms": round(min(latencies), 2),
                "avg_ms": round(avg, 2),
                "max_ms": round(max(latencies), 2),
            }
    
        # ── Download speed measurement ──
        test_server, test_url = _SPEED_TEST_URLS[0]
        download_mbps: float | None = None
        download_bytes: int = 0
        download_ms: float = 0.0
        dl_error: str | None = None
    
        try:
            async with httpx.AsyncClient(
                timeout=httpx.Timeout(60.0),
                follow_redirects=True,
            ) as client:
                start = time.perf_counter()
                response = await client.get(test_url)
                download_ms = (time.perf_counter() - start) * 1000
                download_bytes = len(response.content)
    
                if download_bytes > 0 and download_ms > 0:
                    # bits / milliseconds → megabits per second
                    download_mbps = round(
                        (download_bytes * 8) / (download_ms / 1000) / 1_000_000, 2
                    )
        except Exception as exc:
            dl_error = str(exc)
    
        result: dict = {
            "test_server": test_server,
            "latency": latency_stats if latency_stats else {"error": "All pings failed"},
        }
    
        if dl_error:
            result["download"] = {"error": dl_error}
        else:
            result["download"] = {
                "speed_mbps": download_mbps,
                "bytes_transferred": download_bytes,
                "duration_ms": round(download_ms, 2),
            }
    
        return result
  • Configuration constant defining the speed test server and URL (Cloudflare 10 MB payload) used by the speed_test handler.
    _SPEED_TEST_URLS = [
        # 10 MB payload from Cloudflare
        ("Cloudflare", "https://speed.cloudflare.com/__down?bytes=10000000"),
    ]
  • The @mcp.tool() decorator registers speed_test as a tool with the MCP server (line 33: mcp = FastMCP('sounding')).
    @mcp.tool()
    async def speed_test() -> dict:
Behavior4/5

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

With no annotations, the description fully discloses the test actions (download, TCP pings) and outputs (Mbps, ms), but lacks details on rate limits or network impact.

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?

Three sentences, each purposeful: first states aim, second details download, third details latency. No fluff, front-loaded with purpose.

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

Completeness4/5

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

Given no parameters or output schema, the description covers what the tool does, how it works, and what it returns, which is complete for a simple measurement tool.

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

Parameters4/5

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

There are no parameters, so schema coverage is 100%. The description adds context about the test behavior, which is sufficient and meets the baseline for no-parameter tools.

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

Purpose5/5

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

The description clearly states it measures network download speed and latency, specifying a 10 MB download from Cloudflare and TCP connect pings, which differentiates it from sibling tools like ping (latency only) or dns_lookup.

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 implies usage for combined speed and latency testing, but does not explicitly mention when to use this tool versus alternatives like ping or traceroute, nor provide exclusions.

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/seayniclabs/sounding'

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