{
  "openapi": "3.1.1",
  "info": {
    "title": "Officeloft Mesh Call Bandwidth API",
    "version": "1.0.0",
    "summary": "How much upload a peer-to-peer video call needs for 2–12 people, and whether your line copes.",
    "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://officeloftmeshbandwidth.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "How much upload a peer-to-peer video call needs for 2–12 people, and whether your line copes.",
        "description": "In a peer-to-peer (mesh) call every person sends their audio and video separately to every other person, so the upload grows with each new person. Enter the number of people, the video quality and your line speeds: the planner shows upload, download and connections per person, compares it with a call through a media server, and works out the video bitrate that still fits — the same rule Officeloft uses in its rooms.\n\nMethodology:\n- Mesh call with n people: each person keeps n − 1 connections and sends their audio (and video, if the camera is on) once per connection. Upload = (n − 1) × (audio + video [+ screen share]); download = (n − 1) × audio + (cameras − 1) × video [+ screen share]. Each direction is the worst case for one person (camera on; for upload you share the screen, for download someone else does).\n- Default bitrates per stream: audio 40 kbit/s (Opus fullband speech 28–40 kbit/s per RFC 7587 §7.1, plus packet overhead); video 350 / 800 / 1500 kbit/s for low/standard/high; screen share 1200 kbit/s. These are Officeloft's settings, not limits of WebRTC.\n- Fits = need ≤ line speed × the share you allow. If the upload does not fit, the video cap per outgoing stream = (upload budget ÷ (n − 1)) − audio − screen share, never above the preset. Below 150 kbit/s video is no longer useful and audio only is recommended.\n- With a media server (SFU) each person uploads every stream only once; the comparison column shows that upload. Officeloft rooms connect people directly (no media server) and hold at most 6 people.\n\nReal bitrates vary with motion, light and the browser’s congestion control; treat the numbers as planning values.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "officeloft_mesh_bandwidth",
        "x-owner-app": "officeloft",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfficeloftMeshBandwidthInput"
              },
              "examples": {
                "example1": {
                  "summary": "Four people, standard video, 10/50 Mbit/s line",
                  "value": {
                    "participants": 4,
                    "quality": "standard",
                    "uplinkMbps": 10,
                    "downlinkMbps": 50
                  }
                },
                "example2": {
                  "summary": "Six people, high video, 5 Mbit/s upload",
                  "value": {
                    "participants": 6,
                    "quality": "high",
                    "uplinkMbps": 5,
                    "downlinkMbps": 100
                  }
                },
                "example3": {
                  "summary": "Ten people, low video (beyond a mesh room)",
                  "value": {
                    "participants": 10,
                    "quality": "low"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfficeloftMeshBandwidthResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "OfficeloftMeshBandwidthInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "participants": {
            "title": "People in the call",
            "type": "integer",
            "minimum": 2,
            "maximum": 12,
            "default": 4
          },
          "quality": {
            "title": "Video quality",
            "type": "string",
            "enum": [
              "audio",
              "low",
              "standard",
              "high"
            ],
            "default": "standard"
          },
          "cameras": {
            "title": "Cameras on (empty = everybody)",
            "description": "People who send video. The others only send audio.",
            "type": "integer",
            "minimum": 0,
            "maximum": 12
          },
          "screenShare": {
            "title": "Someone shares their screen",
            "description": "A screen share adds about 1200 kbit/s per receiver.",
            "type": "boolean",
            "default": false
          },
          "uplinkMbps": {
            "title": "Your upload speed (Mbit/s)",
            "description": "From a speed test. Empty = just show the need.",
            "type": "number",
            "minimum": 0.1,
            "maximum": 10000
          },
          "downlinkMbps": {
            "title": "Your download speed (Mbit/s)",
            "type": "number",
            "minimum": 0.1,
            "maximum": 10000
          },
          "headroom": {
            "title": "Share of the line the call may use",
            "description": "Leave room for other traffic: 0.75 = use at most three quarters.",
            "type": "number",
            "minimum": 0.1,
            "maximum": 1,
            "default": 0.75
          }
        },
        "required": []
      },
      "OfficeloftMeshBandwidthResult": {
        "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"
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}