{
  "openapi": "3.1.1",
  "info": {
    "title": "Focus Room Interval Timer Planner API",
    "version": "1.0.0",
    "summary": "HIIT, Tabata and EMOM schedules with every phase and a cue-track WAV to play along.",
    "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://focusroomintervalplan.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "HIIT, Tabata and EMOM schedules with every phase and a cue-track WAV to play along.",
        "description": "Plans an interval workout — Tabata (20 s / 10 s × 8), HIIT, EMOM or your own work and rest lengths with rounds, sets, set breaks, warm-up and cool-down — and lists every phase with its start time. It also renders a cue track: a mono WAV with a bright chime when work starts, a soft tone for rest, 3-2-1 beeps before each round, a halfway signal and a finish chime, to play on any speaker. The Focus Room app runs the same plan live and downloads the same file.\n\nMethodology:\n- Tabata: 20 s work and 10 s rest per round (the protocol of Tabata et al., 1996; usually 8 rounds) after a 10 s get-ready phase. HIIT: 40 s / 20 s with a 1-minute warm-up and cool-down. EMOM: every round starts on the minute; work is the seconds you choose, rest is the rest of the minute. Custom uses your lengths. Rounds and sets are yours in every plan.\n- Phases follow each other without gaps: warm-up, then work and rest per round, a set break between sets, and the cool-down. There is no rest after the very last round.\n- Cues: a sound at the start of every phase, 3-2-1 beeps (880 Hz, 150 ms) in the three seconds before each work phase, two short beeps halfway through work phases of 20 s or more, and three rising chimes at the end. Work chimes use the partial ratios of a free bar (1 : 2.756 : 5.404, Fletcher \u0026 Rossing), rest tones a sine with its octave.\n- The cue track is mono 16-bit PCM: silence of the plan’s length plus 2 s, with every cue mixed in at its exact second and peaks limited to −0.2 dBFS.\n\nA timer, not training or medical advice. Warm up, stop when something hurts, and ask a professional before hard training.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "focusroom_interval_plan",
        "x-owner-app": "focusroom",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FocusroomIntervalPlanInput"
              },
              "examples": {
                "example1": {
                  "summary": "Classic Tabata: 8 rounds of 20 s work and 10 s rest",
                  "value": {
                    "preset": "tabata",
                    "rounds": 8,
                    "sets": 1
                  }
                },
                "example2": {
                  "summary": "EMOM for 10 minutes with 40 s of work each minute",
                  "value": {
                    "preset": "emom",
                    "rounds": 10,
                    "work": 40,
                    "wav": true
                  }
                },
                "example3": {
                  "summary": "Custom: 3 sets of 5 × 45 s / 15 s with a 2-minute set break",
                  "value": {
                    "preset": "custom",
                    "rounds": 5,
                    "sets": 3,
                    "work": 45,
                    "rest": 15,
                    "setRest": 120,
                    "warmup": 120,
                    "cooldown": 60,
                    "wav": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusroomIntervalPlanResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "FocusroomIntervalPlanInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "preset": {
            "title": "Plan",
            "type": "string",
            "enum": [
              "tabata",
              "hiit",
              "emom",
              "custom"
            ],
            "default": "tabata"
          },
          "rounds": {
            "title": "Rounds per set",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 8
          },
          "sets": {
            "title": "Sets",
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 1
          },
          "work": {
            "title": "Work (custom; EMOM: work inside each minute)",
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "default": 30,
            "x-unit": "s"
          },
          "rest": {
            "title": "Rest (custom)",
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "default": 15,
            "x-unit": "s"
          },
          "setRest": {
            "title": "Break between sets (custom)",
            "type": "integer",
            "minimum": 0,
            "maximum": 1800,
            "default": 60,
            "x-unit": "s"
          },
          "warmup": {
            "title": "Warm-up (custom)",
            "type": "integer",
            "minimum": 0,
            "maximum": 1800,
            "default": 0,
            "x-unit": "s"
          },
          "cooldown": {
            "title": "Cool-down (custom)",
            "type": "integer",
            "minimum": 0,
            "maximum": 1800,
            "default": 0,
            "x-unit": "s"
          },
          "countIn": {
            "title": "3-2-1 beeps before each round",
            "type": "boolean",
            "default": true
          },
          "wav": {
            "title": "Render the cue track (WAV)",
            "description": "Up to 20 minutes.",
            "type": "boolean",
            "default": true
          },
          "sampleRate": {
            "title": "Sample rate of the cue track",
            "type": "string",
            "enum": [
              "16000",
              "22050",
              "44100"
            ],
            "default": "16000"
          }
        },
        "required": []
      },
      "FocusroomIntervalPlanResult": {
        "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": [
              "preset",
              "totalSeconds",
              "workSeconds",
              "restSeconds",
              "rounds",
              "phases",
              "cues",
              "wavFile"
            ],
            "properties": {
              "preset": {
                "type": "string"
              },
              "totalSeconds": {
                "type": "integer"
              },
              "workSeconds": {
                "type": "integer"
              },
              "restSeconds": {
                "type": "integer"
              },
              "rounds": {
                "type": "integer"
              },
              "phases": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "kind",
                    "set",
                    "round",
                    "start",
                    "end"
                  ],
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "warmup",
                        "work",
                        "rest",
                        "set-rest",
                        "cooldown"
                      ]
                    },
                    "set": {
                      "type": "integer"
                    },
                    "round": {
                      "type": "integer"
                    },
                    "start": {
                      "type": "integer"
                    },
                    "end": {
                      "type": "integer"
                    }
                  }
                }
              },
              "cues": {
                "type": "integer",
                "description": "Number of cue sounds in the track."
              },
              "wavFile": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}