{
  "openapi": "3.1.1",
  "info": {
    "title": "Binary Silhouette to SVG API",
    "version": "1.0.0",
    "summary": "Turn a binary pixel grid into exact SVG outlines with transparent holes.",
    "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://luminasilhouettetracer.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn a binary pixel grid into exact SVG outlines with transparent holes.",
        "description": "Paste rows of 0 and 1 to produce genuine SVG paths for masks, icons, pixel silhouettes and agent-generated artwork. Four-connected shapes stay separate and transparent holes remain open. No image upload is needed.\n\nMethodology:\n- Exact polygonal outlines of sampled pixels; collinear vertices are removed. No bitmap is embedded in the SVG. Curves are not fitted.\n- Colors use nearest Euclidean encoded-sRGB distance. Alpha is thresholded to opaque or transparent. Small connected regions are dropped to transparency, not merged.\n- Border removal deletes every region of the most frequent opaque border color, including interior regions of that color. Ties use the first palette color.\n- At most 512 pixels per side, 2048 shapes and 60000 nodes. Use logos, icons or flat artwork; photographs may need fewer colors and lower sampling.\n- Read an equal-width 0/1 grid up to 128 by 128. Trace at native size, keep all foreground pixels, and recolor the paths to the chosen HEX value.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_silhouette_tracer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaSilhouetteTracerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Ring with a transparent hole",
                  "value": {
                    "grid": "111\n101\n111",
                    "fill": "#164E63"
                  }
                },
                "example2": {
                  "summary": "Two diagonal pixels",
                  "value": {
                    "grid": "10\n01",
                    "fill": "#000000"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaSilhouetteTracerResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LuminaSilhouetteTracerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "grid": {
            "title": "Binary grid (1 = filled, 0 = transparent)",
            "type": "string",
            "maxLength": 17000,
            "default": "0011100\n0111110\n1100011\n1100011\n0111110\n0011100"
          },
          "fill": {
            "title": "Fill color (six-digit HEX)",
            "type": "string",
            "maxLength": 7,
            "default": "#164E63"
          }
        },
        "required": [
          "grid"
        ]
      },
      "LuminaSilhouetteTracerResult": {
        "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",
              "shapes",
              "holes",
              "nodes",
              "dropped",
              "background",
              "palette",
              "svg"
            ],
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "shapes": {
                "type": "integer"
              },
              "holes": {
                "type": "integer"
              },
              "nodes": {
                "type": "integer"
              },
              "dropped": {
                "type": "integer"
              },
              "background": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "palette": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "svg": {
                "type": "string"
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}