{
  "openapi": "3.1.1",
  "info": {
    "title": "Network Speed Tester API",
    "version": "1.0.0",
    "summary": "Measure latency, jitter, download and upload speed between your browser and our server.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://networkspeedtester.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Measure latency, jitter, download and upload speed between your browser and our server.",
        "description": "Runs in your browser: a series of small requests measures latency and jitter, then a random, incompressible download and an upload measure throughput to this server. Without JavaScript you can enter your own measurements (bytes and milliseconds) and get the same statistics.\n\nMethodology:\n- Latency: the browser sends about 20 tiny no-store requests to /speedtest/ping one after another and times each round trip (the first, which may include connection setup, is discarded). Jitter is the mean absolute difference between consecutive samples.\n- Download: random bytes from /speedtest/download in growing sizes (up to 50 MB) until one transfer takes about 2 seconds; speed = bytes × 8 ÷ time, in megabits per second (10^6 bit/s). The payload is random, so compression cannot inflate the result.\n- Upload: random bytes generated in the browser are POSTed to /speedtest/upload, which discards them and reports how many arrived.\n- Everything runs between your browser and this one server in one region; results to other servers, CDNs or regions can differ a lot. Wi-Fi, VPNs, browser extensions and other traffic on your connection all affect the numbers.\n\nMeasures only the path between your device and our server (single region). Not an official broadband measurement.",
        "tags": [
          "developer"
        ],
        "x-mcp-tool": "network_speed_tester",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkSpeedTesterInput"
              },
              "examples": {
                "example1": {
                  "summary": "Example measurements (fibre-like)",
                  "value": {
                    "pingSamples": "18.2, 17.9, 19.4, 18.1, 25.6, 18.0, 18.3, 17.8, 19.0, 18.4",
                    "downloadBytes": 50000000,
                    "downloadMs": 1420,
                    "uploadBytes": 20000000,
                    "uploadMs": 3350
                  }
                },
                "example2": {
                  "summary": "No measurements yet (explains the test)",
                  "value": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkSpeedTesterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "NetworkSpeedTesterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "pingSamples": {
            "title": "Latency samples (ms)",
            "description": "Round-trip times in milliseconds, separated by commas or spaces. The browser test fills this in.",
            "type": "string",
            "maxLength": 5000
          },
          "downloadBytes": {
            "title": "Downloaded bytes",
            "type": "integer",
            "minimum": 0,
            "maximum": 10000000000
          },
          "downloadMs": {
            "title": "Download time",
            "type": "number",
            "minimum": 0,
            "maximum": 3600000,
            "x-unit": "ms"
          },
          "uploadBytes": {
            "title": "Uploaded bytes",
            "type": "integer",
            "minimum": 0,
            "maximum": 10000000000
          },
          "uploadMs": {
            "title": "Upload time",
            "type": "number",
            "minimum": 0,
            "maximum": 3600000,
            "x-unit": "ms"
          }
        },
        "required": []
      },
      "NetworkSpeedTesterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "measured",
              "latency",
              "downloadMbps",
              "uploadMbps",
              "endpoints"
            ],
            "properties": {
              "measured": {
                "type": "boolean"
              },
              "latency": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "count": {
                    "type": "integer"
                  },
                  "min": {
                    "type": "number"
                  },
                  "median": {
                    "type": "number"
                  },
                  "mean": {
                    "type": "number"
                  },
                  "p90": {
                    "type": "number"
                  },
                  "max": {
                    "type": "number"
                  },
                  "jitter": {
                    "type": "number"
                  }
                }
              },
              "downloadMbps": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "uploadMbps": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "suitability": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "use",
                    "ok"
                  ],
                  "properties": {
                    "use": {
                      "type": "string"
                    },
                    "ok": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              },
              "endpoints": {
                "type": "object",
                "properties": {
                  "ping": {
                    "type": "string"
                  },
                  "download": {
                    "type": "string"
                  },
                  "upload": {
                    "type": "string"
                  },
                  "maxBytes": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}