{
  "openapi": "3.1.0",
  "info": {
    "title": "PrintLab WebMCP POC",
    "version": "1.0.0",
    "description": "Print-webshop tool-set die via de WebMCP browser-API beschikbaar is voor AI-agents. Deze OpenAPI-spec spiegelt de tools die navigator.modelContext registreert in https://bam-ai.be/webmcp-poc/",
    "contact": {
      "name": "Geert Bammens - VIGC",
      "email": "geert.bammens@vigc.be",
      "url": "https://bam-ai.be/webmcp-poc/"
    },
    "license": { "name": "MIT" }
  },
  "servers": [
    { "url": "https://bam-ai.be/webmcp-poc", "description": "Live POC (WebMCP browser-API, geen HTTP-server)" }
  ],
  "x-webmcp": {
    "transport": "browser",
    "discovery": "navigator.modelContext.getTools()",
    "execution": "navigator.modelContext.executeTool(tool, JSON.stringify(input))",
    "note": "Deze 12 operations zijn GEEN HTTP-endpoints. Ze worden uitgevoerd in de browser via de WebMCP API. De OpenAPI-spec is informatief: ze documenteert de schemas zodat agents en developers de tools begrijpen."
  },
  "paths": {
    "/tool/list_products": {
      "post": {
        "operationId": "list_products",
        "summary": "Lijst alle producten in de catalogus",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object" } } } },
        "responses": { "200": { "description": "Array van producten", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductSummary" } } } } } }
      }
    },
    "/tool/get_product": {
      "post": {
        "operationId": "get_product",
        "summary": "Geef volledige details van één product op basis van SKU",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "sku": { "type": "string" } }, "required": ["sku"] } } } },
        "responses": { "200": { "description": "Product details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } } }
      }
    },
    "/tool/search_products": {
      "post": {
        "operationId": "search_products",
        "summary": "Zoek producten op naam, max-prijs en/of finish",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "query": { "type": "string" }, "max_price": { "type": "number" }, "finish": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Gefilterde lijst", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProductSummary" } } } } } }
      }
    },
    "/tool/add_to_cart": {
      "post": {
        "operationId": "add_to_cart",
        "summary": "Voeg een product toe aan het winkelmandje",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "sku": { "type": "string" }, "qty": { "type": "integer", "minimum": 1 }, "options": { "type": "object", "properties": { "paper": { "type": "string" }, "finish": { "type": "string" } } } }, "required": ["sku", "qty"] } } } },
        "responses": { "200": { "description": "Item toegevoegd", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "item": { "$ref": "#/components/schemas/CartItem" }, "cart_subtotal": { "type": "number" } } } } } } }
      }
    },
    "/tool/view_cart": {
      "post": {
        "operationId": "view_cart",
        "summary": "Toon huidige winkelmandje + subtotaal",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object" } } } },
        "responses": { "200": { "description": "Cart-inhoud", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/CartItem" } }, "subtotal": { "type": "number" } } } } } } }
      }
    },
    "/tool/update_quantity": {
      "post": {
        "operationId": "update_quantity",
        "summary": "Wijzig aantal van een cart-item",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "item_id": { "type": "integer" }, "qty": { "type": "integer", "minimum": 1 } }, "required": ["item_id", "qty"] } } } },
        "responses": { "200": { "description": "Item bijgewerkt" } }
      }
    },
    "/tool/remove_from_cart": {
      "post": {
        "operationId": "remove_from_cart",
        "summary": "Verwijder een item uit het winkelmandje",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "item_id": { "type": "integer" } }, "required": ["item_id"] } } } },
        "responses": { "200": { "description": "Item verwijderd" } }
      }
    },
    "/tool/clear_cart": {
      "post": {
        "operationId": "clear_cart",
        "summary": "Maak het winkelmandje leeg",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object" } } } },
        "responses": { "200": { "description": "Cart geleegd" } }
      }
    },
    "/tool/calculate_shipping": {
      "post": {
        "operationId": "calculate_shipping",
        "summary": "Bereken verzendkosten op basis van land-ISO",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "country": { "type": "string", "enum": ["BE", "NL", "DE", "FR", "LU"] } }, "required": ["country"] } } } },
        "responses": { "200": { "description": "Shipping rate", "content": { "application/json": { "schema": { "type": "object", "properties": { "country": { "type": "string" }, "shipping": { "type": "number" }, "currency": { "type": "string" } } } } } } }
      }
    },
    "/tool/checkout": {
      "post": {
        "operationId": "checkout",
        "summary": "Rond bestelling af (gesimuleerd - geen echte order)",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "country": { "type": "string", "enum": ["BE", "NL", "DE", "FR", "LU"] } }, "required": ["name", "email", "country"] } } } },
        "responses": { "200": { "description": "Order details", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "order": { "$ref": "#/components/schemas/Order" } } } } } } }
      }
    },
    "/tool/list_orders": {
      "post": {
        "operationId": "list_orders",
        "summary": "Lijst afgeronde bestellingen in deze sessie",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object" } } } },
        "responses": { "200": { "description": "Order-lijst" } }
      }
    },
    "/tool/get_order": {
      "post": {
        "operationId": "get_order",
        "summary": "Haal volledige details van één order",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "order_id": { "type": "string" } }, "required": ["order_id"] } } } },
        "responses": { "200": { "description": "Order details" } }
      }
    }
  },
  "components": {
    "schemas": {
      "ProductSummary": {
        "type": "object",
        "properties": {
          "sku": { "type": "string", "example": "BC-STD" },
          "name": { "type": "string", "example": "Visitekaartjes standaard" },
          "price_per_unit": { "type": "number", "example": 0.12 },
          "min_qty": { "type": "integer", "example": 50 }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "sku": { "type": "string" },
          "name": { "type": "string" },
          "price_per_unit": { "type": "number" },
          "min_qty": { "type": "integer" },
          "options": {
            "type": "object",
            "properties": {
              "paper": { "type": "array", "items": { "type": "string" } },
              "finish": { "type": "array", "items": { "type": "string" } }
            }
          }
        }
      },
      "CartItem": {
        "type": "object",
        "properties": {
          "item_id": { "type": "integer" },
          "sku": { "type": "string" },
          "qty": { "type": "integer" },
          "options": {
            "type": "object",
            "properties": {
              "paper": { "type": "string" },
              "finish": { "type": "string" }
            }
          },
          "line_total": { "type": "number" }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "order_id": { "type": "string", "example": "ORD-7TJZ28" },
          "name": { "type": "string" },
          "email": { "type": "string" },
          "country": { "type": "string" },
          "items": { "type": "array", "items": { "$ref": "#/components/schemas/CartItem" } },
          "subtotal": { "type": "number" },
          "shipping": { "type": "number" },
          "total": { "type": "number" },
          "placed_at": { "type": "string", "format": "date-time" }
        }
      }
    }
  }
}
