{
  "openapi": "3.1.0",
  "info": {
    "title": "FootyCalc Agent API",
    "version": "1.0.0",
    "description": "Read-only JSON API exposing FootyCalc's public calculator and guide pages, plus deterministic square-footage and area-unit calculations. No authentication required. All areas returned are in square feet unless a unit is stated. Conversion factors follow NIST Special Publication 811; residential floor-area rules reference ANSI Z765.",
    "contact": { "name": "FootyCalc", "url": "https://footycalc.com/about/" },
    "license": { "name": "Reference data belongs to footycalc.com" }
  },
  "servers": [{ "url": "https://footycalc.com" }],
  "paths": {
    "/api/agent": {
      "get": {
        "summary": "Query the public page catalog or run a calculation",
        "operationId": "agentQuery",
        "parameters": [
          {
            "name": "op",
            "in": "query",
            "required": true,
            "description": "Operation to perform.",
            "schema": { "type": "string", "enum": ["help", "list", "search", "get", "calculate", "convert"] }
          },
          { "name": "q", "in": "query", "description": "Search query for op=search (case-insensitive substring match over title, description, path).", "schema": { "type": "string" } },
          { "name": "path", "in": "query", "description": "Site path for op=get, e.g. /tile-calculator/.", "schema": { "type": "string" } },
          { "name": "shape", "in": "query", "description": "For op=calculate: rectangle|circle|triangle|trapezoid.", "schema": { "type": "string", "enum": ["rectangle", "circle", "triangle", "trapezoid"] } },
          { "name": "dims", "in": "query", "description": "Comma-separated feet dimensions for op=calculate. rectangle: length,width; circle: radius; triangle: base,height; trapezoid: base1,base2,height.", "schema": { "type": "string" } },
          { "name": "value", "in": "query", "description": "Numeric value for op=convert.", "schema": { "type": "number" } },
          { "name": "from", "in": "query", "description": "Source unit for op=convert.", "schema": { "type": "string", "enum": ["sqft", "sqm", "sqyd", "sqin", "acre", "hectare", "sqmi"] } },
          { "name": "to", "in": "query", "description": "Target unit for op=convert.", "schema": { "type": "string", "enum": ["sqft", "sqm", "sqyd", "sqin", "acre", "hectare", "sqmi"] } }
        ],
        "responses": {
          "200": {
            "description": "JSON result. Unknown paths or queries return an empty result set with count 0, not an error page.",
            "content": { "application/json": { "schema": { "type": "object" } } }
          },
          "400": { "description": "Missing or invalid parameters for the requested op." }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "MCP server (Streamable HTTP, JSON-RPC 2.0)",
        "description": "Supports initialize, tools/list and tools/call for the same read-only tools: list_site_pages, search_site_pages, get_page_info, calculate_square_footage, convert_area.",
        "operationId": "mcp",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "description": "JSON-RPC 2.0 request" } } }
        },
        "responses": {
          "200": { "description": "JSON-RPC 2.0 response." },
          "405": { "description": "Only POST is supported on this endpoint." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Page": {
        "type": "object",
        "properties": {
          "path": { "type": "string", "description": "Canonical site path, e.g. /tile-calculator/" },
          "url": { "type": "string", "description": "Absolute source_url" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "category": { "type": "string", "enum": ["calculator", "conversion", "guide", "room-size", "info"] },
          "headings": { "type": "array", "items": { "type": "string" } },
          "updated": { "type": "string", "format": "date" }
        },
        "required": ["path", "url", "title", "category"]
      }
    }
  }
}
