{
  "components": {
    "schemas": {
      "Error": {
        "properties": {
          "error": {
            "type": "string"
          },
          "example": {
            "type": "string"
          },
          "usage": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "Health": {
        "properties": {
          "endpoints": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "service": {
            "type": "string"
          },
          "status": {
            "enum": [
              "ok"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "JsonRpcRequest": {
        "properties": {
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "jsonrpc": {
            "const": "2.0",
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object"
          }
        },
        "required": [
          "jsonrpc",
          "method"
        ],
        "type": "object"
      },
      "JsonRpcResponse": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "integer"
              },
              "data": {},
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "jsonrpc": {
            "const": "2.0",
            "type": "string"
          },
          "result": {}
        },
        "required": [
          "jsonrpc",
          "id"
        ],
        "type": "object"
      },
      "SearchResponse": {
        "properties": {
          "lang": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata_hint": {
            "description": "URL template for the per-language title index (metadata enrichment).",
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            },
            "type": "array"
          },
          "returned": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "query",
          "total",
          "returned",
          "results"
        ],
        "type": "object"
      },
      "SearchResult": {
        "properties": {
          "author": {
            "type": [
              "string",
              "null"
            ]
          },
          "excerpt": {
            "description": "HTML with <mark> highlights.",
            "type": "string"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "type": {
            "enum": [
              "article",
              "document",
              "prayer",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "description": "Canonical URL of the hit (append `.md` to fetch source).",
            "type": "string"
          }
        },
        "required": [
          "url",
          "title",
          "excerpt"
        ],
        "type": "object"
      }
    }
  },
  "externalDocs": {
    "description": "Agent skill (askcath): how to use this API",
    "url": "https://dubia.cc/.well-known/agent-skills/askcath/SKILL.md"
  },
  "info": {
    "contact": {
      "email": "info@dubia.cc",
      "url": "https://dubia.cc"
    },
    "description": "Search API and Model Context Protocol (MCP) endpoint exposing every imprimatur-bearing article, vetted document, and traditional prayer published on dubia.cc. Backed by the same Pagefind index the website uses.",
    "license": {
      "name": "CC-BY-4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "summary": "Pagefind-backed search and MCP endpoint for the traditional Catholic corpus at dubia.cc.",
    "title": "dubia.cc API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/health.json": {
      "get": {
        "operationId": "healthCheck",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "Always {\"status\":\"ok\"}; this endpoint exists so the RFC 9727 catalog can advertise a `status` relation."
          }
        },
        "summary": "Static health snapshot."
      }
    },
    "/api/mcp": {
      "post": {
        "description": "Discovery: /.well-known/mcp/server-card.json. Methods: initialize, tools/list, tools/call. Single tool: askcath (same surface as GET /api/search).",
        "operationId": "mcpRpc",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            },
            "description": "JSON-RPC 2.0 response."
          }
        },
        "summary": "Model Context Protocol (Streamable-HTTP, JSON-RPC 2.0)."
      }
    },
    "/api/search": {
      "get": {
        "description": "Returns JSON search hits from the same Pagefind index the website uses. Browser clients are expected to call pagefind directly; this endpoint is for HTTP-only agents that cannot run JavaScript.",
        "operationId": "searchDubiaCC",
        "parameters": [
          {
            "description": "Query string.",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "ISO language code. Omit to search every language.",
            "in": "query",
            "name": "lang",
            "required": false,
            "schema": {
              "enum": [
                "ar",
                "br",
                "de",
                "el",
                "en",
                "es",
                "fr",
                "it",
                "ja",
                "ko",
                "pl",
                "pt",
                "ro",
                "ru",
                "tl",
                "tr",
                "zh"
              ],
              "type": "string"
            }
          },
          {
            "description": "Restrict to one content type.",
            "in": "query",
            "name": "type",
            "required": false,
            "schema": {
              "enum": [
                "article",
                "document",
                "prayer"
              ],
              "type": "string"
            }
          },
          {
            "description": "Max results (1–50).",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 50,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            },
            "description": "Search results."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Missing or invalid parameters."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Internal error (pagefind failed to load)."
          }
        },
        "summary": "Full-text search over articles, documents, and prayers."
      }
    }
  },
  "servers": [
    {
      "description": "Production",
      "url": "https://dubia.cc"
    }
  ]
}