Skip to main content
Glama
inventer-dev

mcp-internet-speed-test

measure_latency

Measures network latency to a URL by taking multiple samples and reporting the minimum, providing accurate representation of connection speed.

Instructions

Measure the latency using multiple samples and report the minimum.

Takes a number of samples and reports the lowest
value for the most accurate representation of network latency.

Args:
    url (str): The URL to measure latency to
    samples (int): Number of samples to take (default: 10)

Returns:
    Dictionary with latency result (minimum of all samples)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNohttps://httpi.dev/get
samplesNo

Implementation Reference

  • The measure_latency function is the actual tool handler. It measures latency by sending HTTP GET requests to a specified URL, recording response times, and returning min/max/avg latency statistics along with server info.
    @mcp.tool(icons=[ICON_LATENCY])
    async def measure_latency(
        url: str = DEFAULT_LATENCY_URL,
        samples: int = 10,
    ) -> dict:
        """Measure the latency using multiple samples and report the minimum.
    
        Takes a number of samples and reports the lowest
        value for the most accurate representation of network latency.
    
        Args:
            url (str): The URL to measure latency to
            samples (int): Number of samples to take (default: 10)
    
        Returns:
            Dictionary with latency result (minimum of all samples)
        """
        latency_values = []
        server_info = None
    
        async with httpx.AsyncClient() as client:
            for sample_index in range(samples):
                start = time.time()
                response = await client.get(url)
                end = time.time()
                latency_values.append((end - start) * 1000)
    
                if sample_index == 0:
                    server_info = extract_server_info(dict(response.headers))
    
        return {
            "latency": round(min(latency_values), 2),
            "unit": "ms",
            "url": url,
            "samples": samples,
            "min_latency": round(min(latency_values), 2),
            "max_latency": round(max(latency_values), 2),
            "avg_latency": round(sum(latency_values) / len(latency_values), 2),
            "server_info": server_info,
        }
  • The @mcp.tool(icons=[ICON_LATENCY]) decorator registers measure_latency as an MCP tool on the FastMCP instance.
    @mcp.tool(icons=[ICON_LATENCY])
  • The function signature defines the input schema: 'url' (str, defaults to DEFAULT_LATENCY_URL) and 'samples' (int, defaults to 10). The return type is dict.
    async def measure_latency(
        url: str = DEFAULT_LATENCY_URL,
        samples: int = 10,
  • Uses the extract_server_info helper to parse HTTP headers and extract CDN/pop/location details from the first sample's response.
    if sample_index == 0:
        server_info = extract_server_info(dict(response.headers))
  • The FastMCP singleton instance that the @mcp.tool decorator registers measure_latency on.
    mcp = FastMCP("internet_speed_test", dependencies=["httpx"])
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only mentions that multiple samples are taken and the minimum is reported, but lacks details on network usage, timeouts, or side effects. It also claims 'most accurate representation' without justification.

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

Conciseness4/5

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

The description is well-structured with a summary, elaboration, and parameter/return documentation. It is front-loaded with the main action. However, there is slight redundancy between the first two sentences.

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?

For a simple tool with two parameters and no output schema, the description adequately explains what it does, how it works (multiple samples, minimum), and the inputs/outputs. It lacks potential error handling or network constraints, but overall is sufficient.

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 0%, so the description must compensate. It describes the 'url' and 'samples' parameters in the Args section, including defaults. While this adds basic context, it does not elaborate on format constraints or validation.

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 it measures latency using multiple samples and reports the minimum. The verb 'measure' and resource 'latency' are specific. However, it does not differentiate from sibling tools like measure_jitter, which may measure related metrics.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as measure_jitter or run_complete_test. It only explains the methodology, not the contextual usage.

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/inventer-dev/mcp-internet-speed-test'

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