{
  "openapi": "3.1.1",
  "info": {
    "title": "Texture Tile Seam Checker API",
    "version": "1.0.0",
    "summary": "Measure opposite-edge jumps and feather a reusable numeric texture tile.",
    "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://renderloomtileseam.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Measure opposite-edge jumps and feather a reusable numeric texture tile.",
        "description": "Turn a typed grayscale grid into a texture tile, compare opposite-edge differences before and after symmetric feathering, and inspect an exact 2 × 2 repeated PNG. Save an editable material project with its original source and blend recipe.\n\nMethodology:\n- Input is a 2–64 row and column grid of 0–1 heights, bilinearly interpolated to 16–512 px. The same deterministic engine is used in the browser Texture Lab and API/MCP.\n- The edge score is the mean absolute RGB difference between corresponding first/last rows and columns, divided by 255. A score of zero means outer pixels match exactly; it is not a perceptual quality score.\n- A blend band of 0–25% per edge symmetrically mixes corresponding edge pairs toward their average. Weight is (1 − distance / band width)². Horizontal blending precedes vertical blending. Pixels outside the bands are unchanged.\n- The 2 × 2 preview repeats the blended tile without interpolation. Feathering can soften edge detail and cannot remove repeated motifs or guarantee continuity of derivatives.\n\nEqual boundary colors do not guarantee matching slopes or an invisible repeating pattern. This is symmetric edge feathering, not texture synthesis.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "renderloom_tile_seam",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderloomTileSeamInput"
              },
              "examples": {
                "example1": {
                  "summary": "An asymmetric ramp",
                  "value": {
                    "grid": "0, 0.25, 0.5, 1\n0.1, 0.4, 0.6, 0.9\n0.3, 0.2, 0.8, 0.75"
                  }
                },
                "example2": {
                  "summary": "Inspect without blending",
                  "value": {
                    "seamBlend": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenderloomTileSeamResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "RenderloomTileSeamInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "grid": {
            "title": "Height grid (0–1, rows separated by newlines)",
            "type": "string",
            "maxLength": 24000,
            "default": "0.15, 0.3, 0.5, 0.3, 0.15\n0.3, 0.65, 0.85, 0.65, 0.3\n0.5, 0.85, 1, 0.85, 0.5\n0.3, 0.65, 0.85, 0.65, 0.3\n0.15, 0.3, 0.5, 0.3, 0.15"
          },
          "size": {
            "title": "Square map size (px)",
            "type": "integer",
            "minimum": 16,
            "maximum": 512,
            "default": 128
          },
          "seamBlend": {
            "title": "Edge feather fraction",
            "type": "number",
            "minimum": 0,
            "maximum": 0.25,
            "default": 0.12
          }
        },
        "required": []
      },
      "RenderloomTileSeamResult": {
        "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": [
              "project",
              "edgeBefore",
              "edgeAfter",
              "original",
              "tile",
              "repeated",
              "projectFile",
              "openInApp"
            ],
            "properties": {
              "project": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "format",
                  "version",
                  "name",
                  "source",
                  "settings"
                ],
                "properties": {
                  "format": {
                    "const": "renderloom-material"
                  },
                  "version": {
                    "const": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "source": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "width",
                      "height",
                      "png"
                    ],
                    "properties": {
                      "width": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 1024
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 1024
                      },
                      "png": {
                        "type": "string",
                        "maxLength": 6000000,
                        "pattern": "^data:image/png;base64,"
                      }
                    }
                  },
                  "settings": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "heightChannel",
                      "heightInvert",
                      "levelLow",
                      "levelHigh",
                      "heightGamma",
                      "blur",
                      "normalStrength",
                      "flipGreen",
                      "roughness",
                      "roughnessVariation",
                      "aoStrength",
                      "aoRadius",
                      "metalness",
                      "seamBlend"
                    ],
                    "properties": {
                      "heightChannel": {
                        "enum": [
                          "luminance",
                          "red",
                          "green",
                          "blue",
                          "alpha"
                        ]
                      },
                      "heightInvert": {
                        "type": "boolean"
                      },
                      "levelLow": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 0.99
                      },
                      "levelHigh": {
                        "type": "number",
                        "minimum": 0.01,
                        "maximum": 1
                      },
                      "heightGamma": {
                        "type": "number",
                        "minimum": 0.2,
                        "maximum": 4
                      },
                      "blur": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 8
                      },
                      "normalStrength": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 20
                      },
                      "flipGreen": {
                        "type": "boolean"
                      },
                      "roughness": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      "roughnessVariation": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      "aoStrength": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 2
                      },
                      "aoRadius": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 16
                      },
                      "metalness": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 1
                      },
                      "seamBlend": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 0.25
                      }
                    }
                  },
                  "packChannels": {
                    "type": "array",
                    "minItems": 4,
                    "maxItems": 4,
                    "items": {
                      "enum": [
                        "ao",
                        "roughness",
                        "metallic",
                        "height",
                        "inv-ao",
                        "inv-roughness",
                        "inv-metallic",
                        "inv-height",
                        "black",
                        "white"
                      ]
                    }
                  }
                }
              },
              "edgeBefore": {
                "type": "number"
              },
              "edgeAfter": {
                "type": "number"
              },
              "original": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "tile": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "repeated": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "projectFile": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "openInApp": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}