{
  "openapi": "3.1.0",
  "info": {
    "title": "Simple Jacks Workbook Studio Agent & Workbook API",
    "version": "0.2.0-dev.17",
    "description": "Remote Streamable HTTP MCP (`2026-07-28`) and REST API for searching 210 canonical templates and reading or proposing revision-fenced edits to bound cloud workbooks."
  },
  "servers": [
    {
      "url": "https://kindly-crab-38.convex.site",
      "description": "Simple Jacks Workbook Studio Convex HTTP Gateway"
    }
  ],
  "components": {
    "securitySchemes": {
      "bindingBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped workbook binding token (`wb_bind_...`) created in Studio -> Connect Agent."
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Service & tenant endpoint discovery",
        "responses": {
          "200": {
            "description": "Service identity and URLs"
          }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "summary": "MCP Streamable HTTP server card",
        "responses": {
          "200": {
            "description": "MCP server metadata"
          }
        }
      },
      "post": {
        "summary": "MCP 2026-07-28 JSON-RPC transport (stateless anonymous or Bearer-bound live workbook)",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/api/v1/templates": {
      "get": {
        "summary": "Search 210 canonical templates & Pro workpaper binders",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "template",
                "sample",
                "demo"
              ]
            }
          },
          {
            "name": "level",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "simple",
                "pro"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Filtered template list"
          }
        }
      }
    },
    "/api/v1/workbook/outline": {
      "get": {
        "summary": "Read bound workbook semantic outline and expectedContextSha256 fence",
        "security": [
          {
            "bindingBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Semantic outline"
          },
          "401": {
            "description": "Missing or invalid bearer token"
          }
        }
      }
    },
    "/api/v1/workbook/range": {
      "get": {
        "summary": "Read bounded A1 cell range (max 400 cells) from bound workbook",
        "security": [
          {
            "bindingBearer": []
          }
        ],
        "parameters": [
          {
            "name": "sheet",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "range",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeFormulas",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Range cells and formulas"
          }
        }
      }
    },
    "/api/v1/workbook/tieouts": {
      "get": {
        "summary": "Read all tie-out verification checks and formula error cells",
        "security": [
          {
            "bindingBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tie-outs and error cells"
          }
        }
      }
    },
    "/api/v1/workbook/propose": {
      "post": {
        "summary": "Submit revision-fenced edits for explicit human Approve / Decline in Studio",
        "security": [
          {
            "bindingBearer": []
          }
        ],
        "responses": {
          "202": {
            "description": "Proposal queued as pending for human decision"
          },
          "403": {
            "description": "Binding token is read-only"
          },
          "409": {
            "description": "Context digest or headSeq is stale"
          }
        }
      }
    },
    "/api/v1/workbook/proposals": {
      "get": {
        "summary": "Poll proposal status and verified post-approval readback",
        "security": [
          {
            "bindingBearer": []
          }
        ],
        "parameters": [
          {
            "name": "proposalId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Proposal record or list"
          }
        }
      }
    }
  }
}
