{
  "openapi": "3.1.1",
  "info": {
    "title": "LayerTrove – öffentlicher Modellkatalog",
    "version": "1.0.0",
    "description": "Lesender Zugang für die Auswahl kommerzieller Modelllizenzen. Öffentliche Modelle und Preise gelten jeweils für die bezeichnete Fassung. Ein regulärer Kauf erfolgt im Shopware-Checkout."
  },
  "servers": [
    {
      "url": "https://layertrove.com"
    }
  ],
  "security": [],
  "externalDocs": {
    "description": "Katalogzugang, Einkaufsablauf und MCP-Beispiele",
    "url": "https://layertrove.com/agenten"
  },
  "paths": {
    "/agenten/api/v1/modelle": {
      "get": {
        "operationId": "searchModels",
        "summary": "Modellangebote durchsuchen und nach Kategorie filtern",
        "description": "Alphabetisch nach Slug sortiert. Kategorien umfassen den zugänglichen Katalog. total und nextPage beziehen sich auf die gewählten Filter.",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "maxLength": 120,
              "description": "Suchtext in deutscher Sprache. Bei nicht leerem Text muss ein Buchstabe oder eine Ziffer enthalten sein."
            },
            "description": "Alle Suchbegriffe müssen im Modelltext vorkommen."
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
            },
            "description": "Schlüssel aus categories[].slug."
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 1
            },
            "description": "Seite, bei eins beginnend."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "description": "Anzahl der Treffer pro Seite."
          }
        ],
        "responses": {
          "200": {
            "description": "Katalogseite mit Treffern und verfügbaren Kategorien.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                }
              }
            }
          },
          "400": {
            "description": "Ungültige Suchparameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogError"
                }
              }
            }
          },
          "429": {
            "description": "Zugriffslimit erreicht."
          }
        }
      }
    },
    "/agenten/api/v1/modelle/{slug}": {
      "get": {
        "operationId": "getModel",
        "summary": "Modellfassung, Lizenzumfang und bestehende Rechte prüfen",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{2,70}$"
            },
            "description": "Stabile Kennung aus der Katalogsuche."
          }
        ],
        "responses": {
          "200": {
            "description": "Öffentliches Angebot. checkoutUrl öffnet die Modellauswahl im Kundenkonto.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfferDetail"
                }
              }
            }
          },
          "404": {
            "description": "Kein öffentliches Angebot für diesen Slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogError"
                }
              }
            }
          },
          "429": {
            "description": "Zugriffslimit erreicht."
          }
        }
      }
    },
    "/agenten/mcp": {
      "post": {
        "operationId": "callMcp",
        "summary": "MCP-Werkzeuge über Streamable HTTP verwenden",
        "description": "Öffentliche Lesewerkzeuge search_models, get_model und get_license_terms. Für Protokollversion 2026-07-28 pro Anfrage die _meta-Felder io.modelcontextprotocol/protocolVersion und io.modelcontextprotocol/clientCapabilities mitsenden. Die älteren Revisionen beginnen mit initialize und notifications/initialized. Der Client sendet Accept: application/json, text/event-stream.",
        "externalDocs": {
          "url": "https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http",
          "description": "Offizielle Transport-Spezifikation"
        },
        "parameters": [
          {
            "in": "header",
            "name": "MCP-Protocol-Version",
            "schema": {
              "type": "string",
              "enum": [
                "2026-07-28",
                "2025-11-25",
                "2025-06-18"
              ]
            },
            "description": "Bei modernen Anfragen und nach dem älteren Initialisierungsdialog erforderlich.",
            "required": false
          },
          {
            "in": "header",
            "name": "Mcp-Method",
            "schema": {
              "type": "string"
            },
            "description": "Für Version 2026-07-28 muss der Wert mit method im JSON übereinstimmen.",
            "required": false
          },
          {
            "in": "header",
            "name": "Mcp-Name",
            "schema": {
              "type": "string",
              "enum": [
                "search_models",
                "get_model",
                "get_license_terms"
              ]
            },
            "description": "Für tools/call in Version 2026-07-28 muss der Wert mit params.name übereinstimmen.",
            "required": false
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RpcInput"
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/call",
                "params": {
                  "_meta": {
                    "io.modelcontextprotocol/protocolVersion": "2026-07-28",
                    "io.modelcontextprotocol/clientCapabilities": {}
                  },
                  "name": "search_models",
                  "arguments": {
                    "q": "Schallplattenständer",
                    "limit": 5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC-Ergebnis oder Protokollfehler.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/RpcSuccess"
                    },
                    {
                      "$ref": "#/components/schemas/RpcError"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Initialisierungsbenachrichtigung angenommen."
          },
          "400": {
            "description": "Ungültige RPC-Anfrage."
          },
          "403": {
            "description": "Unzulässiger Browser-Origin."
          },
          "406": {
            "description": "Accept-Header ist ungeeignet."
          },
          "413": {
            "description": "Anfrage zu groß."
          },
          "415": {
            "description": "Anfrage erfordert JSON."
          },
          "429": {
            "description": "Zugriffslimit erreicht."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Category": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "slug",
          "label"
        ]
      },
      "Version": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "label"
        ]
      },
      "Price": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{2}$",
            "description": "Angezeigter EUR-Endpreis für ein Lizenzjahr als Dezimalzahl mit zwei Nachkommastellen."
          },
          "currency": {
            "const": "EUR"
          },
          "amountMinor": {
            "type": "integer",
            "minimum": 1,
            "description": "Angezeigter Preis in Eurocent."
          },
          "includesTax": {
            "const": true
          }
        },
        "required": [
          "amount",
          "currency",
          "amountMinor",
          "includesTax"
        ]
      },
      "StandardOffer": {
        "type": "object",
        "properties": {
          "durationMonths": {
            "const": 12
          },
          "autoRenew": {
            "const": false
          },
          "paymentType": {
            "const": "one_time"
          }
        },
        "required": [
          "durationMonths",
          "autoRenew",
          "paymentType"
        ]
      },
      "LicenseTerms": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StandardOffer"
          },
          {
            "type": "object",
            "properties": {
              "scope": {
                "type": "string"
              },
              "fileSalesAllowed": {
                "const": false
              },
              "fileSharingAllowed": {
                "const": false
              },
              "sublicensingAllowed": {
                "const": false
              },
              "modelFileIncluded": {
                "const": false
              },
              "printedObjectIncluded": {
                "const": false
              },
              "fileRequirement": {
                "type": "string"
              },
              "startsWhen": {
                "type": "string"
              },
              "licenseeRequirements": {
                "type": "string"
              },
              "renewal": {
                "type": "string"
              },
              "priceBasis": {
                "type": "string"
              },
              "existingRights": {
                "type": "string"
              },
              "commercialUse": {
                "type": "string"
              },
              "termsUrl": {
                "type": "string",
                "format": "uri"
              },
              "licenseModelUrl": {
                "type": "string",
                "format": "uri"
              },
              "withdrawalUrl": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "scope",
              "fileSalesAllowed",
              "fileSharingAllowed",
              "sublicensingAllowed",
              "modelFileIncluded",
              "printedObjectIncluded",
              "fileRequirement",
              "startsWhen",
              "licenseeRequirements",
              "renewal",
              "priceBasis",
              "existingRights",
              "commercialUse",
              "termsUrl",
              "licenseModelUrl",
              "withdrawalUrl"
            ]
          }
        ]
      },
      "OfferSummary": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{2,70}$"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "$ref": "#/components/schemas/Category"
          },
          "summary": {
            "type": "string"
          },
          "version": {
            "$ref": "#/components/schemas/Version"
          },
          "price": {
            "$ref": "#/components/schemas/Price"
          },
          "license": {
            "$ref": "#/components/schemas/StandardOffer"
          },
          "productUrl": {
            "type": "string",
            "format": "uri"
          },
          "detailUrl": {
            "type": "string",
            "format": "uri"
          },
          "imageUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "slug",
          "sku",
          "name",
          "category",
          "summary",
          "version",
          "price",
          "license",
          "productUrl",
          "detailUrl",
          "imageUrl"
        ]
      },
      "PriorRights": {
        "type": "object",
        "properties": {
          "notice": {
            "type": "string"
          },
          "paragraphs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri-reference"
                }
              },
              "required": [
                "label",
                "url"
              ]
            }
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "notice",
          "paragraphs",
          "links",
          "sourceUrl"
        ]
      },
      "OfferDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/OfferSummary"
          },
          {
            "type": "object",
            "properties": {
              "description": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "license": {
                "$ref": "#/components/schemas/LicenseTerms"
              },
              "priorRights": {
                "$ref": "#/components/schemas/PriorRights"
              },
              "images": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "alt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "alt"
                  ]
                }
              },
              "videoUrl": {
                "type": ["string", "null"],
                "format": "uri"
              },
              "checkoutUrl": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "description",
              "license",
              "priorRights",
              "images",
              "videoUrl",
              "checkoutUrl"
            ]
          }
        ]
      },
      "Collection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfferSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "default": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 20
          },
          "nextPage": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "limit",
          "nextPage",
          "categories"
        ]
      },
      "CatalogError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "RpcId": {
        "type": [
          "integer",
          "string"
        ]
      },
      "RpcInput": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "$ref": "#/components/schemas/RpcId"
          },
          "method": {
            "type": "string",
            "enum": [
              "server/discover",
              "initialize",
              "notifications/initialized",
              "ping",
              "tools/list",
              "tools/call"
            ]
          },
          "params": {
            "type": "object",
            "properties": {
              "_meta": {
                "type": "object"
              }
            }
          }
        },
        "required": [
          "jsonrpc",
          "method"
        ]
      },
      "RpcSuccess": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "$ref": "#/components/schemas/RpcId"
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "result"
        ]
      },
      "RpcError": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "integer",
              "string",
              "null"
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              },
              "data": {}
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "jsonrpc",
          "error"
        ]
      }
    }
  }
}
