{
  "openapi": "3.1.1",
  "info": {
    "title": "Perspective Guide Generator API",
    "version": "1.0.0",
    "summary": "Create a transparent one- or two-point perspective guide for drawing.",
    "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://fliplineperspectiveguide.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Create a transparent one- or two-point perspective guide for drawing.",
        "description": "Set a horizon, vanishing points and ray density to generate a transparent SVG guide for painting, illustration or animation.\n\nMethodology:\n- The horizon is a percentage of canvas height from the top. Vanishing points are percentages of width from the left and lie on the horizon. Values from -200% to 300% allow points outside the canvas.\n- For each point, target positions are spaced uniformly around the canvas perimeter. Infinite lines through the point and targets are clipped to the canvas; duplicate lines are removed. Actual line count may be lower than the target.\n- The horizon is drawn only when it lies within the canvas. Colors must be six-digit HEX; opacity applies to both horizon and rays. The exported SVG is transparent and contains no external resources.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "flipline_perspective_guide",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FliplinePerspectiveGuideInput"
              },
              "examples": {
                "example1": {
                  "summary": "A two-point room guide",
                  "value": {
                    "width": 1200,
                    "height": 800,
                    "mode": "two",
                    "horizon": 45,
                    "first": 15,
                    "second": 85,
                    "rays": 16
                  }
                },
                "example2": {
                  "summary": "A one-point corridor guide",
                  "value": {
                    "width": 1000,
                    "height": 700,
                    "mode": "one",
                    "horizon": 50,
                    "first": 50,
                    "rays": 24
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FliplinePerspectiveGuideResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "FliplinePerspectiveGuideInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "width": {
            "title": "Canvas width (px)",
            "type": "integer",
            "minimum": 64,
            "maximum": 4096,
            "default": 1200
          },
          "height": {
            "title": "Canvas height (px)",
            "type": "integer",
            "minimum": 64,
            "maximum": 4096,
            "default": 800
          },
          "mode": {
            "title": "Perspective",
            "type": "string",
            "enum": [
              "one",
              "two"
            ],
            "default": "two"
          },
          "horizon": {
            "title": "Horizon from top (%)",
            "type": "number",
            "minimum": -200,
            "maximum": 300,
            "default": 45
          },
          "first": {
            "title": "First vanishing point from left (%)",
            "type": "number",
            "minimum": -200,
            "maximum": 300,
            "default": 15
          },
          "second": {
            "title": "Second vanishing point from left (%)",
            "type": "number",
            "minimum": -200,
            "maximum": 300,
            "default": 85
          },
          "rays": {
            "title": "Target rays per point",
            "type": "integer",
            "minimum": 4,
            "maximum": 48,
            "default": 16
          },
          "lineColor": {
            "title": "Ray color (six-digit HEX)",
            "type": "string",
            "maxLength": 7,
            "default": "#4E7FAD"
          },
          "horizonColor": {
            "title": "Horizon color (six-digit HEX)",
            "type": "string",
            "maxLength": 7,
            "default": "#E88755"
          },
          "opacity": {
            "title": "Guide opacity (%)",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 40
          }
        },
        "required": []
      },
      "FliplinePerspectiveGuideResult": {
        "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": [
              "width",
              "height",
              "horizon",
              "families",
              "svg"
            ],
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "horizon": {
                "type": "number"
              },
              "svg": {
                "type": "string"
              },
              "families": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "vanishingPoint",
                    "lines"
                  ],
                  "properties": {
                    "vanishingPoint": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "x",
                        "y"
                      ],
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      }
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "x1",
                          "y1",
                          "x2",
                          "y2"
                        ],
                        "properties": {
                          "x1": {
                            "type": "number"
                          },
                          "y1": {
                            "type": "number"
                          },
                          "x2": {
                            "type": "number"
                          },
                          "y2": {
                            "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"
              }
            }
          }
        }
      }
    }
  }
}