{
  "openapi": "3.1.1",
  "info": {
    "title": "Multi-Layer Exposure Planner API",
    "version": "1.0.0",
    "summary": "Plan independent drawing exposures, holds and blanks across up to four layers.",
    "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://fliplineexposureplanner.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Plan independent drawing exposures, holds and blanks across up to four layers.",
        "description": "Write named exposure columns with drawing references, repeated holds and blanks. Get an exact multi-layer timing plan, drawing-board frame count, GIF timing, CSV and an SVG sheet. This planning tool uses text only; Xsheet Desk adds source artwork and playback locally.\n\nMethodology:\n- Each line names one column and expands space-, comma- or semicolon-separated drawing references. NxH exposes drawing N for H ticks; zero is blank, and a dot repeats the preceding reference. A hold before the first cell is invalid. Up to four columns and 240 ticks; shorter columns pad with blanks.\n- Composite segments merge adjacent ticks only when every column reference matches. Drawing-board conversion splits runs at ten ticks and must fit 24 frames plus source complexity limits. This planner reports frame count without compiling artwork.\n- GIF segments split at ten seconds. Each delay is rounded(endTick × 100 / FPS) − rounded(startTick × 100 / FPS), in centiseconds. Rounded cumulative boundaries limit total drift; timing remains approximate in players. Xsheet Desk GIF export allows at most 48 segments.\n- CSV is a row-per-tick reference table with formula-prefix escaping for column names. SVG is a timing sheet with escaped labels and no embedded artwork. No audio, camera animation, OpenToonz scene files or drawing generation is involved.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "flipline_exposure_planner",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FliplineExposurePlannerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Three independently timed columns",
                  "value": {
                    "columns": "Bird | 1x2 2x2 3x2 2x2\nClouds | 1x4 2x4\nScenery | 1x8",
                    "drawings": 3,
                    "fps": 12
                  }
                },
                "example2": {
                  "summary": "A blank and a held drawing",
                  "value": {
                    "columns": "Character | 0x2 1x2 .x4\nBackdrop | 1x8",
                    "drawings": 1,
                    "fps": 24
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FliplineExposurePlannerResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "FliplineExposurePlannerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "columns": {
            "title": "Exposure columns: Name | 1x2 2x2 0x1 .x3",
            "type": "string",
            "maxLength": 8000,
            "default": "Bird | 1x2 2x2 3x2 2x2\nClouds | 1x4 2x4\nScenery | 1x8"
          },
          "drawings": {
            "title": "Available source drawings per column",
            "type": "integer",
            "minimum": 1,
            "maximum": 24,
            "default": 3
          },
          "fps": {
            "title": "Frame rate (FPS)",
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "default": 12
          }
        },
        "required": [
          "columns"
        ]
      },
      "FliplineExposurePlannerResult": {
        "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": [
              "names",
              "cells",
              "ticks",
              "columns",
              "durationMs",
              "changes",
              "boardFrames",
              "gifFrames",
              "gifDurationMs",
              "runs",
              "gifDelays"
            ],
            "properties": {
              "names": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "cells": {
                "type": "array",
                "minItems": 1,
                "maxItems": 4,
                "items": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 240,
                  "items": {
                    "type": "integer"
                  }
                }
              },
              "ticks": {
                "type": "integer"
              },
              "columns": {
                "type": "integer"
              },
              "durationMs": {
                "type": "number"
              },
              "changes": {
                "type": "integer"
              },
              "boardFrames": {
                "type": "integer"
              },
              "gifFrames": {
                "type": "integer"
              },
              "gifDurationMs": {
                "type": "number"
              },
              "runs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "startTick",
                    "endTick",
                    "drawings"
                  ],
                  "properties": {
                    "startTick": {
                      "type": "integer"
                    },
                    "endTick": {
                      "type": "integer"
                    },
                    "drawings": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "gifDelays": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}