{
  "openapi": "3.1.1",
  "info": {
    "title": "Sketchboard Auto Layout API",
    "version": "1.0.0",
    "summary": "Tidy up a diagram automatically: layered flowchart layout or a balanced mind map.",
    "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://sketchboardautolayout.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Tidy up a diagram automatically: layered flowchart layout or a balanced mind map.",
        "description": "Takes a Sketchboard board or a plain list of links (“A -\u003e B”) and arranges the boxes: a layered layout with few crossings for flowcharts and graphs in any direction, or a balanced left/right tree for mind maps. Returns the new positions, an SVG and the board file.\n\nMethodology:\n- Nodes are the board’s shapes, notes, texts and props that are not locked; links are connectors glued at both ends. From a link list every distinct name becomes a rounded box sized to its text.\n- Layered layout (Sugiyama et al. 1981): DFS back edges are reversed to remove cycles, ranks follow the longest path from the sources, long links get dummy nodes, barycentre sweeps (up to 12, the best ordering is kept) reduce crossings, and median alignment straightens links before overlaps are pushed apart. The result lists the number of crossings left between neighbouring ranks.\n- Mind map: a breadth-first tree from the root (the mind-map root shape, else the node with the most links); first-level branches go alternately right and left, whichever side is shorter so far, and every subtree is stacked vertically by its height.\n- The layout keeps the top-left corner of the old drawing and only moves boxes; glued connectors follow automatically.\n\nA layout is a starting point: very dense graphs keep some crossings, and nodes are not resized.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "sketchboard_auto_layout",
        "x-owner-app": "sketchboard",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SketchboardAutoLayoutInput"
              },
              "examples": {
                "example1": {
                  "summary": "Product plan from a link list",
                  "value": {
                    "edges": "Idea -\u003e Research\nResearch -\u003e Prototype\nPrototype -\u003e User test\nUser test -\u003e Prototype: needs changes\nUser test -\u003e Launch\nResearch -\u003e Budget\nBudget -\u003e Launch"
                  }
                },
                "example2": {
                  "summary": "The same links left to right with wider gaps",
                  "value": {
                    "edges": "Idea -\u003e Research\nResearch -\u003e Prototype\nPrototype -\u003e User test\nUser test -\u003e Prototype: needs changes\nUser test -\u003e Launch\nResearch -\u003e Budget\nBudget -\u003e Launch",
                    "direction": "LR",
                    "gapX": 60,
                    "gapY": 90
                  }
                },
                "example3": {
                  "summary": "Mind map board (template) re-balanced",
                  "value": {
                    "board": "{\"format\":\"sketchboard\",\"version\":1,\"name\":\"Project kickoff\",\"settings\":{\"grid\":20,\"showGrid\":true,\"snap\":true,\"sketchy\":false,\"unit\":\"m\",\"scale\":50,\"background\":\"#ffffff\"},\"layers\":[{\"id\":\"l1\",\"name\":\"Layer 1\",\"visible\":true,\"locked\":false}],\"elements\":[{\"id\":\"e3\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#64748b\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e5\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e4\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e7\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e6\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e9\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e8\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"eb\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#64748b\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ea\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ed\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ea\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ec\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ef\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ea\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ee\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"eh\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ea\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"eg\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ej\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#64748b\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ei\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"el\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ei\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ek\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"en\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ei\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"em\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ep\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ei\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"eo\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"er\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#64748b\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"eq\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"et\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"eq\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"es\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ev\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"eq\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"eu\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ex\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#64748b\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ew\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"ez\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ew\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"ey\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e11\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ew\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e10\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e13\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2.5,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"ew\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e12\",\"port\":\"auto\"},\"route\":\"curved\",\"startHead\":\"none\",\"endHead\":\"none\"},{\"id\":\"e1\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":420,\"y\":159,\"w\":200,\"h\":64,\"rot\":0,\"text\":\"Website relaunch\",\"fill\":\"#dbeafe\",\"stroke\":\"#1d4ed8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":20,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-root\"},{\"id\":\"e2\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":690,\"y\":94,\"w\":130,\"h\":44,\"rot\":0,\"text\":\"Goals\",\"fill\":\"#dcfce7\",\"stroke\":\"#334155\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":17,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-topic\"},{\"id\":\"e4\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":50,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"More sign-ups\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"e6\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":100,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Faster pages\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"e8\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":150,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Easier editing\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"ea\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":220,\"y\":44,\"w\":130,\"h\":44,\"rot\":0,\"text\":\"People\",\"fill\":\"#fef3c7\",\"stroke\":\"#334155\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":17,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-topic\"},{\"id\":\"ec\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Design: Mia\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"ee\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":50,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Code: Jonas\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"eg\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":100,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Content: Ada\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"ei\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":690,\"y\":244,\"w\":130,\"h\":44,\"rot\":0,\"text\":\"Timeline\",\"fill\":\"#fce7f3\",\"stroke\":\"#334155\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":17,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-topic\"},{\"id\":\"ek\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":200,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Discovery (2 weeks)\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"em\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":250,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Build (6 weeks)\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"eo\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":890,\"y\":300,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Launch in May\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"eq\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":220,\"y\":169,\"w\":130,\"h\":44,\"rot\":0,\"text\":\"Risks\",\"fill\":\"#fee2e2\",\"stroke\":\"#334155\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":17,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-topic\"},{\"id\":\"es\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":150,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Old links break\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"eu\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":200,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Content not ready\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"ew\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":220,\"y\":294,\"w\":130,\"h\":44,\"rot\":0,\"text\":\"Budget\",\"fill\":\"#e0e7ff\",\"stroke\":\"#334155\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":17,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-topic\"},{\"id\":\"ey\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":250,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Design 30 %\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"e10\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":300,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Development 55 %\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"},{\"id\":\"e12\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":0,\"y\":350,\"w\":150,\"h\":32,\"rot\":0,\"text\":\"Buffer 15 %\",\"fill\":\"none\",\"stroke\":\"#94a3b8\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":15,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"mind-leaf\"}]}",
                    "mode": "mindmap"
                  }
                },
                "example4": {
                  "summary": "Flowchart board laid out left to right",
                  "value": {
                    "board": "{\"format\":\"sketchboard\",\"version\":1,\"name\":\"Sign-up flow\",\"settings\":{\"grid\":20,\"showGrid\":true,\"snap\":true,\"sketchy\":false,\"unit\":\"m\",\"scale\":50,\"background\":\"#ffffff\"},\"layers\":[{\"id\":\"l1\",\"name\":\"Layer 1\",\"visible\":true,\"locked\":false}],\"elements\":[{\"id\":\"ea\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e1\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"eb\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e3\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ec\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"no\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e3\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e4\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ed\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e4\",\"port\":\"e\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e2\",\"port\":\"e\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ee\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"yes\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e3\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e5\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ef\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"yes\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e5\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e6\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"eg\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"no\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e5\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e7\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"eh\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e7\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e8\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ei\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e8\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e9\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"ej\",\"type\":\"line\",\"layer\":\"l1\",\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"rot\":0,\"text\":\"\",\"fill\":\"none\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":14,\"color\":\"#111827\",\"align\":\"center\",\"start\":{\"x\":0,\"y\":0,\"el\":\"e6\",\"port\":\"auto\"},\"end\":{\"x\":0,\"y\":0,\"el\":\"e9\",\"port\":\"auto\"},\"route\":\"elbow\",\"startHead\":\"none\",\"endHead\":\"arrow\"},{\"id\":\"e1\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":73,\"y\":60,\"w\":260,\"h\":66,\"rot\":0,\"text\":\"Visitor opens the sign-up page\",\"fill\":\"#dcfce7\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"terminator\"},{\"id\":\"e2\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":98,\"y\":196,\"w\":210,\"h\":48,\"rot\":0,\"text\":\"Fill in name and e-mail\",\"fill\":\"#ffffff\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"process\"},{\"id\":\"e3\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":64,\"y\":314,\"w\":277,\"h\":80,\"rot\":0,\"text\":\"Is the e-mail valid?\",\"fill\":\"#fef3c7\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"decision\"},{\"id\":\"e4\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":415,\"y\":480,\"w\":256,\"h\":48,\"rot\":0,\"text\":\"Show a clear error message\",\"fill\":\"#ffffff\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"process\"},{\"id\":\"e5\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":40,\"y\":464,\"w\":325,\"h\":80,\"rot\":0,\"text\":\"Account exists already?\",\"fill\":\"#fef3c7\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"decision\"},{\"id\":\"e6\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":92,\"y\":622,\"w\":221,\"h\":48,\"rot\":0,\"text\":\"Offer to sign in instead\",\"fill\":\"#ffffff\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"process\"},{\"id\":\"e7\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":363,\"y\":614,\"w\":188,\"h\":64,\"rot\":0,\"text\":\"Create the account\",\"fill\":\"#ffffff\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"database\"},{\"id\":\"e8\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":292,\"y\":748,\"w\":231,\"h\":48,\"rot\":0,\"text\":\"Send the welcome e-mail\",\"fill\":\"#ffffff\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"process\"},{\"id\":\"e9\",\"type\":\"shape\",\"layer\":\"l1\",\"x\":197,\"y\":866,\"w\":193,\"h\":48,\"rot\":0,\"text\":\"Show the dashboard\",\"fill\":\"#dcfce7\",\"stroke\":\"#1f2937\",\"sw\":2,\"dash\":\"solid\",\"opacity\":1,\"font\":\"sans\",\"size\":16,\"color\":\"#111827\",\"align\":\"center\",\"shape\":\"terminator\"}]}",
                    "mode": "layered",
                    "direction": "LR"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SketchboardAutoLayoutResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "SketchboardAutoLayoutInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "edges": {
            "title": "Links, one per line",
            "description": "For example “Idea -\u003e Research” or “Research -\u003e Prototype: needs a budget”. A line with only a name adds a lonely box. Ignored when a board is given.",
            "type": "string",
            "maxLength": 200000,
            "default": ""
          },
          "board": {
            "title": "Or a Sketchboard board (JSON)",
            "description": "A .sketchboard.json file. Shapes that are glued to connectors are laid out; locked shapes stay.",
            "type": "string",
            "maxLength": 4000000,
            "default": ""
          },
          "mode": {
            "title": "Layout",
            "type": "string",
            "enum": [
              "auto",
              "layered",
              "mindmap"
            ],
            "default": "auto"
          },
          "direction": {
            "title": "Direction (layered)",
            "type": "string",
            "enum": [
              "TB",
              "LR",
              "BT",
              "RL"
            ],
            "default": "TB"
          },
          "gapX": {
            "title": "Gap between neighbours",
            "type": "integer",
            "minimum": 10,
            "maximum": 400,
            "default": 40
          },
          "gapY": {
            "title": "Gap between ranks",
            "type": "integer",
            "minimum": 10,
            "maximum": 400,
            "default": 60
          }
        },
        "required": []
      },
      "SketchboardAutoLayoutResult": {
        "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"
              }
            }
          }
        }
      }
    }
  }
}