{
  "openapi": "3.1.1",
  "info": {
    "title": "SVG Repeat Pattern Generator API",
    "version": "1.0.0",
    "summary": "Create a seamless, editable SVG pattern from simple shapes.",
    "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://luminarepeatpattern.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Create a seamless, editable SVG pattern from simple shapes.",
        "description": "Make repeating dots, squares, diamonds, stripes or checkerboards with adjustable spacing, color and opacity. Preview and download a self-contained SVG with an optional transparent background.\n\nMethodology:\n- A square SVG pattern tile uses user-space units, so its spacing is measured in the canvas coordinate system.\n- A centered dot, square, diamond or horizontal or vertical stripe repeats across the canvas. Mark size is bounded by tile spacing; for stripes it is the band thickness. A checkerboard uses two squares in diagonally opposite half-tiles, and its mark size cannot exceed half the spacing.\n- An optional solid background lies below the pattern; foreground opacity applies to the marks. The SVG embeds no external assets.\n- For a reliably repeatable canvas swatch, make both dimensions multiples of the tile spacing.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_repeat_pattern",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaRepeatPatternInput"
              },
              "examples": {
                "example1": {
                  "summary": "Ink dots on paper",
                  "value": {
                    "width": 672,
                    "height": 480,
                    "spacing": 48,
                    "size": 16,
                    "shape": "dot",
                    "foreground": "#264F59",
                    "background": "#F5EEDD",
                    "opacity": 1
                  }
                },
                "example2": {
                  "summary": "Translucent diamonds",
                  "value": {
                    "width": 640,
                    "height": 480,
                    "spacing": 40,
                    "size": 20,
                    "shape": "diamond",
                    "foreground": "#264F59",
                    "background": "none",
                    "opacity": 0.5
                  }
                },
                "example3": {
                  "summary": "Horizontal stripes",
                  "value": {
                    "width": 640,
                    "height": 480,
                    "spacing": 40,
                    "size": 12,
                    "shape": "horizontal-stripe",
                    "foreground": "#264F59",
                    "background": "#F5EEDD",
                    "opacity": 1
                  }
                },
                "example4": {
                  "summary": "Checkerboard",
                  "value": {
                    "width": 640,
                    "height": 480,
                    "spacing": 40,
                    "size": 20,
                    "shape": "checkerboard",
                    "foreground": "#264F59",
                    "background": "#F5EEDD",
                    "opacity": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaRepeatPatternResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LuminaRepeatPatternInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "shape": {
            "title": "Mark shape",
            "type": "string",
            "enum": [
              "dot",
              "square",
              "diamond",
              "horizontal-stripe",
              "vertical-stripe",
              "checkerboard"
            ],
            "default": "dot"
          },
          "width": {
            "title": "Canvas width (px)",
            "type": "integer",
            "minimum": 16,
            "maximum": 4096,
            "default": 672
          },
          "height": {
            "title": "Canvas height (px)",
            "type": "integer",
            "minimum": 16,
            "maximum": 4096,
            "default": 480
          },
          "spacing": {
            "title": "Tile spacing (px)",
            "type": "integer",
            "minimum": 4,
            "maximum": 512,
            "default": 48
          },
          "size": {
            "title": "Mark size (px)",
            "type": "integer",
            "minimum": 1,
            "maximum": 512,
            "default": 16
          },
          "foreground": {
            "title": "Mark color (six-digit HEX)",
            "type": "string",
            "maxLength": 7,
            "default": "#264F59"
          },
          "background": {
            "title": "Background (six-digit HEX or none)",
            "type": "string",
            "maxLength": 7,
            "default": "#F5EEDD"
          },
          "opacity": {
            "title": "Mark opacity",
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 1
          }
        },
        "required": []
      },
      "LuminaRepeatPatternResult": {
        "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": [
              "svg",
              "tile"
            ],
            "properties": {
              "svg": {
                "type": "string"
              },
              "tile": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "width",
                  "height",
                  "markSize",
                  "originX",
                  "originY"
                ],
                "properties": {
                  "width": {
                    "type": "integer"
                  },
                  "height": {
                    "type": "integer"
                  },
                  "markSize": {
                    "type": "integer"
                  },
                  "originX": {
                    "type": "number"
                  },
                  "originY": {
                    "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"
              }
            }
          }
        }
      }
    }
  }
}