{
 "openapi": "3.1.0",
 "info": {
  "title": "CleanCleaver Library",
  "version": "1.0.0",
  "description": "Search Utah food safety answers and read the full text. Read-only, no sign-in. Every result carries an attribution field and a license field. The same library is an MCP server (Streamable HTTP) at https://cleancleaver.com/mcp with the tools search_guides, get_rule, how_long, get_checklist, search_library and get_article.",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  },
  "contact": {
   "name": "CleanCleaver",
   "url": "https://cleancleaver.com/contact/"
  },
  "x-attribution": "Source: CleanCleaver Library, cleancleaver.com"
 },
 "servers": [
  {
   "url": "https://cleancleaver.com"
  }
 ],
 "paths": {
  "/library/search": {
   "get": {
    "operationId": "searchLibrary",
    "summary": "Search the library by question or keywords",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 2,
       "maxLength": 200
      },
      "description": "A question or keywords, like \"croissant how long\"."
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 10,
       "default": 5
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Top matches, best first",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "query": {
           "type": "string"
          },
          "results": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "slug": {
              "type": "string"
             },
             "kind": {
              "type": "string",
              "enum": [
               "guide",
               "howlong",
               "blog",
               "help"
              ]
             },
             "title": {
              "type": "string"
             },
             "questions": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "answer": {
              "type": "string"
             },
             "url": {
              "type": "string",
              "format": "uri"
             },
             "dateModified": {
              "type": "string",
              "format": "date"
             },
             "citations": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "tags": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "attribution": {
              "type": "string"
             },
             "score": {
              "type": "number"
             }
            }
           }
          },
          "attribution": {
           "type": "object",
           "properties": {
            "required": {
             "type": "boolean"
            },
            "text": {
             "type": "string"
            },
            "url": {
             "type": "string",
             "format": "uri"
            },
            "publisher": {
             "type": "string"
            }
           }
          },
          "license": {
           "type": "object",
           "properties": {
            "name": {
             "type": "string"
            },
            "url": {
             "type": "string",
             "format": "uri"
            },
            "terms": {
             "type": "string"
            },
            "publicDomainNote": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Missing or too-short query"
     },
     "403": {
      "description": "The library is not public yet"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  },
  "/library/a/{slug}.json": {
   "get": {
    "operationId": "getArticle",
    "summary": "The full text of one page as Markdown, with sources, attribution and license",
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^[a-z0-9][a-z0-9-]*$"
      },
      "description": "A slug from the search results, like howlong-pastries."
     }
    ],
    "responses": {
     "200": {
      "description": "The page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "slug": {
           "type": "string"
          },
          "title": {
           "type": "string"
          },
          "url": {
           "type": "string",
           "format": "uri"
          },
          "dateModified": {
           "type": "string",
           "format": "date"
          },
          "markdown": {
           "type": "string"
          },
          "sources": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "label": {
              "type": "string"
             },
             "url": {
              "type": "string"
             }
            }
           }
          },
          "attribution": {
           "type": "object",
           "properties": {
            "required": {
             "type": "boolean"
            },
            "text": {
             "type": "string"
            },
            "url": {
             "type": "string",
             "format": "uri"
            },
            "publisher": {
             "type": "string"
            }
           }
          },
          "license": {
           "type": "object",
           "properties": {
            "name": {
             "type": "string"
            },
            "url": {
             "type": "string",
             "format": "uri"
            },
            "terms": {
             "type": "string"
            },
            "publicDomainNote": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "No such page"
     }
    }
   }
  },
  "/library/search.json": {
   "get": {
    "operationId": "getSearchIndex",
    "summary": "The whole search index (every page: title, questions, short answer, URL, dates, citations, tags)",
    "responses": {
     "200": {
      "description": "The index",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  }
 }
}