{
  "openapi": "3.1.1",
  "info": {
    "title": "Slow Web Resource Budget API",
    "version": "1.0.0",
    "summary": "Model a resource list under bandwidth, latency, caching and packet-loss assumptions.",
    "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://signalhouseresourcebudget.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Model a resource list under bandwidth, latency, caching and packet-loss assumptions.",
        "description": "Compare a resource list or HAR in sequential and shared-link modes with explicit throughput assumptions, cache effects and a baseline waterfall.\n\nMethodology:\n- Signalhouse tcpModel supplies aggregate window/loss/bandwidth-limited throughput. A host needs two RTTs of modeled setup and each uncached resource one request RTT.\n- Sequential mode transfers one resource at a time. Shared-link mode fairly divides that aggregate throughput among ready resources, with a bounded number in flight; it is not an implementation of HTTP/2, HTTP/3 or browser scheduling.\n- HAR import reads sizes and cache indicators. Modeled requests do not fetch resource URLs. CPU, rendering, dependency discovery, DNS/TLS details and real traffic are excluded.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "signalhouse_resource_budget",
        "x-owner-app": "signalhouse",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignalhouseResourceBudgetInput"
              },
              "examples": {
                "example1": {
                  "summary": "Try an example",
                  "value": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalhouseResourceBudgetResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "SignalhouseResourceBudgetInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "bandwidth": {
            "title": "Bandwidth (Mbit/s)",
            "type": "number",
            "minimum": 0.001,
            "maximum": 100000,
            "default": 5
          },
          "rtt": {
            "title": "Round-trip latency (ms)",
            "type": "number",
            "minimum": 0.1,
            "maximum": 10000,
            "default": 100
          },
          "loss": {
            "title": "Packet loss (%)",
            "type": "number",
            "minimum": 0,
            "maximum": 99,
            "default": 0
          },
          "mode": {
            "title": "Transfer model",
            "type": "string",
            "enum": [
              "sequential",
              "shared"
            ],
            "default": "sequential"
          },
          "connections": {
            "title": "Concurrent resources in shared-link mode",
            "type": "number",
            "minimum": 1,
            "maximum": 12,
            "default": 6
          },
          "resources": {
            "title": "Resources",
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "title": "Resource",
                  "type": "string",
                  "maxLength": 100000
                },
                "host": {
                  "title": "Host",
                  "type": "string",
                  "maxLength": 100000
                },
                "bytes": {
                  "title": "Transferred bytes",
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                },
                "cached": {
                  "title": "Cached",
                  "type": "boolean",
                  "default": false
                }
              },
              "required": [
                "name",
                "host",
                "bytes"
              ]
            },
            "default": [
              {
                "name": "index.html",
                "host": "example.test",
                "bytes": 25000,
                "cached": false
              },
              {
                "name": "photo.jpg",
                "host": "example.test",
                "bytes": 1500000,
                "cached": false
              }
            ]
          }
        },
        "required": []
      },
      "SignalhouseResourceBudgetResult": {
        "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",
            "additionalProperties": false,
            "required": [
              "waterfall",
              "totalBytes",
              "seconds",
              "throughputMbps",
              "limitedBy",
              "mode",
              "connections",
              "sequentialSeconds",
              "savedSeconds",
              "cachedResources",
              "hosts",
              "svg"
            ],
            "properties": {
              "waterfall": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "host",
                    "bytes",
                    "cached",
                    "startSeconds",
                    "endSeconds",
                    "durationSeconds"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "number"
                    },
                    "cached": {
                      "type": "boolean"
                    },
                    "startSeconds": {
                      "type": "number"
                    },
                    "endSeconds": {
                      "type": "number"
                    },
                    "durationSeconds": {
                      "type": "number"
                    }
                  }
                }
              },
              "totalBytes": {
                "type": "number"
              },
              "seconds": {
                "type": "number"
              },
              "throughputMbps": {
                "type": "number"
              },
              "limitedBy": {
                "type": "string"
              },
              "mode": {
                "type": "string"
              },
              "connections": {
                "type": "number"
              },
              "sequentialSeconds": {
                "type": "number"
              },
              "savedSeconds": {
                "type": "number"
              },
              "cachedResources": {
                "type": "number"
              },
              "hosts": {
                "type": "number"
              },
              "svg": {
                "type": "string"
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}