{
  "openapi": "3.1.1",
  "info": {
    "title": "Palette Contrast Matrix API",
    "version": "1.0.0",
    "summary": "Check every palette color pairing against WCAG text contrast thresholds.",
    "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://luminapalettecontrast.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Check every palette color pairing against WCAG text contrast thresholds.",
        "description": "Paste up to 24 opaque colors in HEX, GPL or JASC-PAL format. Compare every foreground and background pair, with exact ratios and AA, AAA and large-text results, then download a CSV report.\n\nMethodology:\n- Decode opaque sRGB channels to linear light using the 0.04045 breakpoint and calculate luminance with coefficients 0.2126, 0.7152 and 0.0722.\n- Contrast is (lighter luminance + 0.05)/(darker luminance + 0.05). Normal text AA needs 4.5:1 and AAA 7:1. Large text AA needs 3:1 and AAA 4.5:1. Threshold decisions use unrounded ratios.\n- Rows are foregrounds; columns are backgrounds. Identical-color pairs have ratio 1. Large text means at least 18 pt regular or 14 pt bold. Color-pair results do not certify a complete interface or text over photographs.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_palette_contrast",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaPaletteContrastInput"
              },
              "examples": {
                "example1": {
                  "summary": "A three-color interface palette",
                  "value": {
                    "colors": "#164E63 #72A5A0 #ECF0DE"
                  }
                },
                "example2": {
                  "summary": "Black and white",
                  "value": {
                    "colors": "#000000 #FFFFFF"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaPaletteContrastResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LuminaPaletteContrastInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "colors": {
            "title": "HEX, GPL or JASC-PAL palette",
            "type": "string",
            "maxLength": 16384,
            "default": "#164E63 #72A5A0 #ECF0DE"
          }
        },
        "required": []
      },
      "LuminaPaletteContrastResult": {
        "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": [
              "colors",
              "pairs"
            ],
            "properties": {
              "colors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "pairs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "row",
                    "column",
                    "foreground",
                    "background",
                    "ratio",
                    "aa",
                    "aaa",
                    "largeAA",
                    "largeAAA"
                  ],
                  "properties": {
                    "row": {
                      "type": "integer"
                    },
                    "column": {
                      "type": "integer"
                    },
                    "foreground": {
                      "type": "string"
                    },
                    "background": {
                      "type": "string"
                    },
                    "ratio": {
                      "type": "number"
                    },
                    "aa": {
                      "type": "boolean"
                    },
                    "aaa": {
                      "type": "boolean"
                    },
                    "largeAA": {
                      "type": "boolean"
                    },
                    "largeAAA": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}