{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://spec.openapis.org/oas/3.1/dialect/base",
  "info": {
    "title": "Games List HTTP API",
    "version": "0.1.0",
    "description": "Source-derived contract for the Rust/Axum SQLx SQLite application and TanStack static UI. Covers all explicit HTTP operations, public-client OAuth and the MCP transport envelope. Game state consists only of source-qualified list membership and optional personal ratings. No deployment or provider availability is implied. Examples are synthetic. REST data routes accept an account session or scoped API key; MCP uses separate scoped OAuth grants. Host must match a configured origin; browser writes require the matching Origin. See docs/api/README.md and endpoint-coverage.md for limits, validation and source provenance."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8080",
      "description": "Loopback development default; replace with the authorized APP_ORIGIN for another environment."
    }
  ],
  "tags": [
    {
      "name": "Operations"
    },
    {
      "name": "Accounts"
    },
    {
      "name": "Games"
    },
    {
      "name": "Lists"
    },
    {
      "name": "Filters"
    },
    {
      "name": "OAuth"
    },
    {
      "name": "MCP transport"
    }
  ],
  "security": [],
  "paths": {
    "/auth/google/start": {
      "get": {
        "operationId": "google_start",
        "summary": "Start Google sign-in or account creation",
        "description": "Google sign-in must be configured. Uses browser-bound one-use state, PKCE and nonce. A verified new Google identity creates a separate account; existing password accounts require an explicit authenticated link.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "responses": {
          "303": {
            "description": "Redirect to Google and set a short-lived HttpOnly transaction cookie."
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "429": {
            "description": "Google flow starts or pending transaction capacity are temporarily limited."
          }
        },
        "x-handler": "src/google.rs::start"
      }
    },
    "/auth/google": {
      "get": {
        "operationId": "google_start_next",
        "summary": "Start Google sign-in and return to a path",
        "description": "Same flow as /auth/google/start. A relative next path (one leading slash, at most 2048 bytes, no backslash or control characters) is stored with the one-use transaction and the 303 after sign-in returns to it, for example the pending /oauth/authorize request; anything else returns to /. GOOGLE_ALLOWED_EMAILS, when set to a list, limits Google sign-in to those verified emails (\"*\" or unset allows any verified account). A verified OWNER_EMAIL whose Google subject is unlinked links to the existing OWNER_USERNAME account instead of creating one, if that account has no Google identity yet.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "parameters": [
          {
            "name": "next",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "303": {
            "description": "Redirect to Google and set a short-lived HttpOnly transaction cookie."
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "429": {
            "description": "Google flow starts or pending transaction capacity are temporarily limited."
          }
        },
        "x-handler": "src/google.rs::start_next"
      }
    },
    "/auth/google/link": {
      "post": {
        "operationId": "google_link",
        "summary": "Link Google to the current account",
        "description": "Requires a valid session and same-origin POST. The same session must remain valid until callback; an identity already linked elsewhere cannot be transferred.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "responses": {
          "303": {
            "description": "Redirect to Google and set a short-lived HttpOnly transaction cookie."
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "429": {
            "description": "Google flow starts or pending transaction capacity are temporarily limited."
          }
        },
        "x-handler": "src/google.rs::link"
      }
    },
    "/auth/google/callback": {
      "get": {
        "operationId": "google_callback_legacy",
        "summary": "Reject legacy query-based Google callbacks",
        "description": "Query-based callbacks are not processed. Begin a new sign-in or link flow.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "responses": {
          "400": {
            "$ref": "#/components/responses/400"
          }
        },
        "x-handler": "src/google.rs::callback_legacy"
      },
      "post": {
        "operationId": "google_callback",
        "summary": "Complete a Google sign-in or link",
        "description": "Accepts the Google form-post and a same-origin continuation, then validates browser-bound one-use state, PKCE, nonce, the ID token, and any existing linking session. A verified new Google subject receives a separate account and starter lists; matching email never links to an existing account. A successful sign-in rotates the prior session. Failures create no session and include a reference ID.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "code": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "error": {
                    "type": "string",
                    "maxLength": 256
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "No-store browser continuation for the cross-site Google form-post.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "303": {
            "description": "Redirect to the application after successful sign-in or linking."
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "429": {
            "description": "New account creation is temporarily rate-limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "422": {
            "description": "Malformed or duplicate form fields."
          }
        },
        "x-handler": "src/google.rs::callback"
      }
    },
    "/healthz": {
      "get": {
        "operationId": "health",
        "summary": "Check schema readiness",
        "description": "Constant-time PRAGMA user_version check against the compiled schema version. Reads /app/RELEASE, or returns release=local. Does not check provider connectivity, full integrity, accounts or MCP. No Host/Origin checks.",
        "tags": [
          "Operations"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReady"
                },
                "example": {
                  "status": "ok",
                  "release": "local"
                }
              }
            }
          },
          "503": {
            "description": "Schema query failed or version differs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthUnready"
                },
                "example": {
                  "status": "unready"
                }
              }
            }
          }
        },
        "x-handler": "src/main.rs::health"
      }
    },
    "/api/status": {
      "get": {
        "operationId": "status",
        "summary": "Read configured provider and modes",
        "description": "Public configuration report subject to Host/Origin checks; no login required. Synthetic games are invented fixtures. IGDB is a server-side integration, not a separate inbound API.",
        "tags": [
          "Operations"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderStatus"
                },
                "example": {
                  "google_sign_in": false,
                  "provider": "synthetic",
                  "message": "IGDB is not connected. All games shown are invented test fixtures.",
                  "mcp": "disabled",
                  "mode": "local-demo"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/403"
          }
        },
        "x-handler": "src/main.rs::status",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ]
      }
    },
    "/api/session": {
      "get": {
        "operationId": "session_status",
        "summary": "Inspect browser session",
        "description": "No authentication required. Duplicate gl_session values are treated as no session. Demo returns mode=demo, signed_in=true and no username. A valid account session also returns that account's username; no other user record is returned.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionStatus"
                },
                "examples": {
                  "signedOut": {
                    "value": {
                      "mode": "accounts",
                      "signed_in": false
                    }
                  },
                  "signedIn": {
                    "value": {
                      "mode": "accounts",
                      "signed_in": true,
                      "username": "example-user"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::session_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ]
      }
    },
    "/api/login": {
      "post": {
        "operationId": "login",
        "summary": "Sign in to an existing account",
        "description": "Account mode only; otherwise 400. Exact username authentication. Length failures precede rate limiting. Limiter keys trim/lowercase username, but authentication does not. A successful login creates a new 24-hour session. No account signup endpoint.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Signed_InResult"
                },
                "example": {
                  "signed_in": true
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "Set-Cookie": {
                "$ref": "#/components/headers/SessionCookie"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        },
        "x-handler": "src/main.rs::login",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              },
              "example": {
                "username": "example_player",
                "password": "synthetic-example-password"
              }
            }
          }
        }
      }
    },
    "/api/logout": {
      "post": {
        "operationId": "logout",
        "summary": "Clear browser session",
        "description": "Origin required, but valid session and account mode are not required. Revokes a supplied session token if present and clears the cookie. Body, if supplied, is ignored. Does not revoke MCP grants.",
        "tags": [
          "Accounts"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Signed_InResult"
                },
                "example": {
                  "signed_in": false
                }
              }
            },
            "headers": {
              "Set-Cookie": {
                "$ref": "#/components/headers/SessionCookie"
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::logout",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ]
      }
    },
    "/api/grants": {
      "get": {
        "operationId": "account_grants",
        "summary": "List owned OAuth grant families",
        "description": "Account mode only; otherwise 400 before principal checks. Includes inactive families. No pagination or bearer-token support.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GrantSummary"
                  }
                },
                "example": [
                  {
                    "family": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "client": "https://chatgpt.com/oauth/client.json",
                    "scope": "read",
                    "expires_at": 1893456000,
                    "active": false
                  }
                ]
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::account_grants",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "Cookie required when ACCOUNT_MODE=1; local-demo resolves to the shared local user without a cookie."
      }
    },
    "/api/grants/{family}/revoke": {
      "post": {
        "operationId": "account_revoke_grant",
        "summary": "Revoke an owned grant family",
        "description": "Account mode only. Revokes every access and refresh token in the family, scoped to the signed-in account. Repeated revocation of a known family succeeds. Body ignored. Helper errors, including database errors, are mapped to 400 Invalid grant identifier.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedResult"
                },
                "example": {
                  "revoked": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::account_revoke_grant",
        "parameters": [
          {
            "$ref": "#/components/parameters/Family"
          },
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "x-account-mode": "Cookie required when ACCOUNT_MODE=1; local-demo resolves to the shared local user without a cookie."
      }
    },
    "/api/keys": {
      "get": {
        "operationId": "account_keys",
        "summary": "List the signed-in account's API keys",
        "description": "Session only. Includes revoked and expired keys; never returns token values. Response is no-store.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Owned keys without secret values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeySummary"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::account_keys",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ]
      },
      "post": {
        "operationId": "account_create_key",
        "summary": "Generate an account API key",
        "description": "Session and Origin required. The returned secret is shown once, stored only as a hash, and expires after one year. Maximum 50 active keys per account. Response is no-store.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New key metadata and one-time token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::account_create_key",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ]
      }
    },
    "/api/keys/{id}/revoke": {
      "post": {
        "operationId": "account_revoke_key",
        "summary": "Revoke an account API key",
        "description": "Session and Origin required. Only the owner may revoke a key; repeating a known revocation succeeds.",
        "tags": [
          "Accounts"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::account_revoke_key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          }
        ]
      }
    },
    "/api/catalog/options": {
      "get": {
        "operationId": "catalog_options",
        "summary": "Browse or search provider taxonomy values",
        "description": "Cursor-paginated canonical provider IDs and names. No counts are implied. IDs lookup is mutually exclusive with q, after and limit. Name queries reject controls, double quotes, backslashes and values over 120 UTF-8 bytes. Provider data can change between pages.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "platforms",
                "genres",
                "themes",
                "keywords",
                "developers",
                "publishers",
                "series"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          },
          {
            "name": "ids",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated list of one to eight positive IDs."
          },
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of catalog options",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogOptionsPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::catalog_options",
        "x-account-mode": "A session or read-scoped API key is required in account mode; local demo uses the shared local user."
      }
    },
    "/api/games/search": {
      "post": {
        "operationId": "search",
        "summary": "Search the configured game catalog",
        "description": "Read operation transported as POST: requires Origin for a browser session, or a read-scope API key. Filter validation occurs before IGDB search. Exact category lookup must resolve one IGDB name or the provider path returns 503. Synthetic search uses fixtures. No GET search endpoint.",
        "tags": [
          "Games"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "headers": {
              "X-List-Snapshot": {
                "description": "Opaque account-bound membership snapshot, returned when the request starts a snapshot.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                },
                "example": {
                  "total": 1,
                  "games": [
                    {
                      "source": "synthetic",
                      "id": 1,
                      "name": "Clockwork Orchard",
                      "summary": "Explore a mechanical garden in this fictional example.",
                      "cover_url": null,
                      "platforms": [
                        "Demo Console",
                        "Example PC"
                      ],
                      "genres": [
                        "Adventure"
                      ],
                      "keywords": [
                        "exploration"
                      ],
                      "themes": [
                        "Fantasy"
                      ],
                      "developer": "Example Studio",
                      "publisher": "Example Publisher",
                      "release_date": 1640995200,
                      "user_rating": 91.0,
                      "user_rating_count": 100,
                      "critic_rating": 78.0,
                      "critic_rating_count": 12
                    }
                  ],
                  "facets": {
                    "scope": "page",
                    "platforms": {
                      "Demo Console": 1,
                      "Example PC": 1
                    },
                    "genres": {
                      "Adventure": 1
                    },
                    "themes": {
                      "Fantasy": 1
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "410": {
            "description": "Snapshot expired, was evicted, belongs to a different account, or does not match the filters; start again."
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::search",
        "parameters": [
          {
            "$ref": "#/components/parameters/DataOrigin"
          },
          {
            "name": "X-List-Snapshot",
            "in": "header",
            "required": false,
            "description": "Send `start` on the first page of a membership-filtered search and reuse the returned token for later pages. A token is bound to the account and non-pagination filters, expires after two hours of inactivity, and may be evicted when the account starts more than 16 snapshots. An expired or invalid token returns 410; start a fresh search.",
            "schema": {
              "type": "string",
              "maxLength": 36
            }
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Filter"
              },
              "example": {
                "genres": [
                  "Adventure"
                ],
                "genre_mode": "any",
                "min_user_rating": 70,
                "limit": 12,
                "sort": "name",
                "descending": false,
                "offset": 0
              }
            }
          }
        }
      }
    },
    "/api/games/{id}": {
      "get": {
        "operationId": "details",
        "summary": "Fetch current catalog game details",
        "description": "Fetches only from the currently configured catalog. Synthetic unknown ID returns 404. IGDB invalid/nonpositive/missing ID and other provider failures return 503. Existing list snapshots are independent.",
        "tags": [
          "Games"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Game"
                },
                "example": {
                  "source": "synthetic",
                  "id": 1,
                  "name": "Clockwork Orchard",
                  "summary": "Explore a mechanical garden in this fictional example.",
                  "cover_url": null,
                  "platforms": [
                    "Demo Console",
                    "Example PC"
                  ],
                  "genres": [
                    "Adventure"
                  ],
                  "keywords": [
                    "exploration"
                  ],
                  "themes": [
                    "Fantasy"
                  ],
                  "developer": "Example Studio",
                  "publisher": "Example Publisher",
                  "release_date": 1640995200,
                  "user_rating": 91.0,
                  "user_rating_count": 100,
                  "critic_rating": 78.0,
                  "critic_rating_count": 12
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::details",
        "parameters": [
          {
            "$ref": "#/components/parameters/GameId"
          },
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      }
    },
    "/api/lists": {
      "get": {
        "operationId": "lists",
        "summary": "List the current account’s lists",
        "description": "Returns every owned list ordered by name, including entry counts, whether it is built in and a preview of up to four most recently added entries. No pagination. Initial Backlog and Played are provisioned by CLI/migration and protected from rename or deletion; membership records state.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/List"
                  }
                },
                "example": [
                  {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "name": "Example shortlist",
                    "count": 1,
                    "built_in": false,
                    "preview": [
                      {
                        "source": "synthetic",
                        "id": 1,
                        "name": "Clockwork Orchard",
                        "cover_url": null
                      }
                    ]
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::lists",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      },
      "post": {
        "operationId": "create_list",
        "summary": "Create or reuse an owned list",
        "description": "Trims name and requires 1–80 UTF-8 bytes after trimming. Idempotent by account and exact trimmed name. Always returns 200 with ID, including newly created lists; no 201 or Location. Custom lists can also be renamed and deleted.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdResult"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::create_list",
        "parameters": [
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListNameRequest"
              },
              "example": {
                "name": "Example shortlist"
              }
            }
          }
        }
      }
    },
    "/api/lists/{id}": {
      "patch": {
        "operationId": "rename_list",
        "summary": "Rename an owned custom list",
        "description": "Renames an owned custom list. Backlog, Played and Favorites are protected. A duplicate name returns 409.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListNameRequest"
              },
              "example": {
                "name": "Updated shortlist"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "List renamed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenamedResult"
                },
                "example": {
                  "renamed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "description": "A list with that name already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "List name already exists"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::rename_list"
      },
      "delete": {
        "operationId": "delete_list",
        "summary": "Delete an owned custom list",
        "description": "Idempotently deletes an owned custom list and its entries. Built-in lists are protected; missing, protected or other-account IDs return removed false.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the delete attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemovedResult"
                },
                "example": {
                  "removed": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::delete_list"
      }
    },
    "/api/imports": {
      "post": {
        "operationId": "bulk_import",
        "summary": "Add a bounded batch of memberships",
        "description": "Add 1–100 memberships to owned lists. The account-scoped key replays the committed receipt and conflicts when reused with different items. A provider failure or 20-second hydration deadline returns committed=false and retryable_error per item, commits nothing and permits retry with the same key. More than eight unresolved identities requires splitting the batch before retrying. No ratings or existing snapshots are changed. A missing game is reported per item. Busy imports return 429. Keys and list IDs are limited by UTF-8 byte length.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkImport"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed per-item receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "429": {
            "description": "Import capacity is busy; retry later."
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::bulk_import"
      }
    },
    "/api/history/finished-lists": {
      "get": {
        "operationId": "get_finished_lists",
        "summary": "Read the explicitly selected finished collections",
        "description": "Returns only the current account's selections. No collection is selected automatically.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Selected owned list IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinishedListSelection"
                },
                "example": {
                  "list_ids": []
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::get_finished_lists"
      },
      "put": {
        "operationId": "put_finished_lists",
        "summary": "Replace the explicitly selected finished collections",
        "description": "Atomically replaces the caller's selections with up to 100 owned list IDs. Supply the list_ids from the previous read as expected_list_ids; a changed selection returns 409 without changes. Unknown or foreign IDs return 404 without changes. Memberships and completion dates are not changed. Duplicate IDs are deduplicated.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinishedListUpdate"
              },
              "example": {
                "list_ids": [],
                "expected_list_ids": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current selected owned list IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinishedListSelection"
                },
                "example": {
                  "list_ids": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::put_finished_lists"
      }
    },
    "/api/history": {
      "get": {
        "operationId": "history",
        "summary": "Read recorded completions and undated Played games",
        "description": "Returns explicitly dated games in any owned list plus undated Played and explicitly selected finished-list entries, deduplicated by source and ID, with dates descending and unknown last. No date or completion is inferred from custom-list membership. Dates are calendar values, not timestamps.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Owned games and optional completion dates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/HistoryEntry"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::history"
      }
    },
    "/api/completions/{source}/{game_id}": {
      "get": {
        "operationId": "get_completion",
        "summary": "Read a saved game's completion date",
        "description": "Null means no date is recorded. Access requires current membership in an owned list.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          },
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Completion calendar date or null.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompletionDate"
                },
                "example": {
                  "completed_on": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::get_completion"
      },
      "put": {
        "operationId": "put_completion",
        "summary": "Set or clear a saved game's completion date",
        "description": "Sets a valid YYYY-MM-DD calendar date or clears it with null. Requires current membership in an owned list. Stored dates survive removal and re-addition, but are hidden while the game is not in any owned list. Does not alter ratings or other lists.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompletionDate"
              },
              "example": {
                "completed_on": "2024-02-29"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved completion calendar date or null.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompletionDate"
                },
                "example": {
                  "completed_on": "2024-02-29"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::put_completion"
      }
    },
    "/api/lists/{id}/items": {
      "get": {
        "operationId": "list_games",
        "summary": "Read stored game snapshots in an owned list",
        "description": "Unpaginated array ordered by added_at then game_id. Equal time/ID entries from different sources have no explicit tie-breaker. Unknown/other-account list returns 404. Invalid stored game JSON returns 500. Snapshots are not fetched fresh from the provider.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Game"
                  }
                },
                "example": [
                  {
                    "source": "synthetic",
                    "id": 1,
                    "name": "Clockwork Orchard",
                    "summary": "Explore a mechanical garden in this fictional example.",
                    "cover_url": null,
                    "platforms": [
                      "Demo Console",
                      "Example PC"
                    ],
                    "genres": [
                      "Adventure"
                    ],
                    "keywords": [
                      "exploration"
                    ],
                    "themes": [
                      "Fantasy"
                    ],
                    "developer": "Example Studio",
                    "publisher": "Example Publisher",
                    "release_date": 1640995200,
                    "user_rating": 91.0,
                    "user_rating_count": 100,
                    "critic_rating": 78.0,
                    "critic_rating_count": 12
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::list_games",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      },
      "post": {
        "operationId": "add_game",
        "summary": "Add a current catalog game to a list",
        "description": "Checks list ownership, fetches the game from the configured provider, then inserts its snapshot. Unique by list/source/game ID; duplicate gives added=false. No user-defined game payload, state, personal rating or provider credentials accepted.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddedResult"
                },
                "example": {
                  "added": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::add_game",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddGameRequest"
              },
              "example": {
                "game_id": 1
              }
            }
          }
        }
      }
    },
    "/api/lists/{id}/refresh": {
      "post": {
        "operationId": "refresh_list",
        "summary": "Atomically add all matches to an owned list",
        "description": "Manual additive scan, maximum 5000 matches. Replaces caller pagination/sort with ascending ID pages of 100. Fetches and checks all pages before committing new entries; no partial additions on failure. IGDB resolves exact name/role lookups once per scan and bypasses cached games/counts. Rejects count changes (409), incomplete/unordered/duplicate pages (503), too many matches (400). Existing snapshots remain unchanged; no deletion. Provider has no snapshot isolation, so some concurrent changes cannot be detected.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshResult"
                },
                "example": {
                  "added": 1,
                  "matched": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/main.rs::refresh_list",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshFilter"
              },
              "example": {
                "genres": [
                  "Adventure"
                ]
              }
            }
          }
        }
      }
    },
    "/api/lists/{id}/items/{source}/{game_id}": {
      "delete": {
        "operationId": "remove_game",
        "summary": "Remove a source-qualified list entry",
        "description": "Deletes only entries in an owned list. Unknown/other-account list, source or game returns 200 removed=false; does not return 404. Body ignored. Does not delete the game from other lists.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemovedResult"
                },
                "example": {
                  "removed": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::remove_game",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListId"
          },
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      }
    },
    "/api/memberships": {
      "get": {
        "operationId": "memberships",
        "summary": "List which owned lists contain each game",
        "description": "Returns one row per entry across every owned list, ordered by list ID, source and game ID, without stored game data. Lets a client mark list membership without reading every list. No pagination.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Membership"
                  }
                },
                "example": [
                  {
                    "list_id": "00000000-0000-4000-8000-000000000001",
                    "source": "synthetic",
                    "game_id": 1,
                    "personal_rating": null
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::memberships",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      }
    },
    "/api/personal-reviews/{source}/{game_id}": {
      "get": {
        "operationId": "get_personal_review",
        "summary": "Read a private review for an owned Played game",
        "description": "Returns null review and text when no review is saved. Unsupported or malformed saved JSON returns the plain text with review_unavailable true. Reviews survive leaving and rejoining Played but are accessible only while in Played.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          }
        ],
        "responses": {
          "200": {
            "description": "Stored review and plain-text fallback.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "review",
                    "text"
                  ],
                  "properties": {
                    "review": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "text": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "review_unavailable": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "review": null,
                  "text": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::get_personal_review"
      },
      "put": {
        "operationId": "put_personal_review",
        "summary": "Save or clear a private review for an owned Played game",
        "description": "Null clears the review without changing the rating or Played membership. A review is Lexical JSON, limited to 32768 serialized UTF-8 bytes and 500 nodes. Only root, paragraph, text, and linebreak nodes are allowed; text supports bold and italic, normal mode, empty style and detail zero. No links, custom nodes, or HTML are accepted. The server derives plain text from the validated tree.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "review"
                ],
                "properties": {
                  "review": {
                    "type": [
                      "object",
                      "null"
                    ]
                  }
                }
              },
              "example": {
                "review": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated review and plain-text fallback.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "review",
                    "text"
                  ],
                  "properties": {
                    "review": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "text": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                },
                "example": {
                  "review": null,
                  "text": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::put_personal_review"
      }
    },
    "/api/personal-ratings/{source}/{game_id}": {
      "get": {
        "operationId": "get_personal_rating",
        "summary": "Read a personal rating for an owned Played game",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Null is unrated; 0 is a valid rating.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "rating"
                  ],
                  "properties": {
                    "rating": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 10
                    }
                  }
                },
                "example": {
                  "rating": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::get_personal_rating",
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          }
        ]
      },
      "put": {
        "operationId": "put_personal_rating",
        "summary": "Set or clear a personal rating for an owned Played game",
        "description": "Only whole numbers from 0 through 10 or null are accepted. Null clears the rating while keeping Played membership.",
        "tags": [
          "Lists"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "rating"
                ],
                "properties": {
                  "rating": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 10
                  }
                }
              },
              "example": {
                "rating": 8
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated rating.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "rating"
                  ],
                  "properties": {
                    "rating": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 10
                    }
                  }
                },
                "example": {
                  "rating": 8
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::put_personal_rating",
        "parameters": [
          {
            "$ref": "#/components/parameters/Source"
          },
          {
            "$ref": "#/components/parameters/ItemGameId"
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ]
      }
    },
    "/api/filters": {
      "get": {
        "operationId": "saved_filters",
        "summary": "Read owned saved filters",
        "description": "Unpaginated, ordered by name. Rows with invalid stored JSON are silently omitted. Saved rules do not schedule refreshes or create list associations.",
        "tags": [
          "Filters"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SavedFilter"
                  }
                },
                "example": [
                  {
                    "id": "00000000-0000-4000-8000-000000000001",
                    "name": "Example adventures",
                    "revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "filter": {
                      "search": null,
                      "platform": null,
                      "genre": null,
                      "keyword": null,
                      "theme": null,
                      "developer": null,
                      "publisher": null,
                      "platforms": [],
                      "genres": [
                        "Adventure"
                      ],
                      "keywords": [],
                      "themes": [],
                      "developers": [],
                      "publishers": [],
                      "platform_mode": "any",
                      "genre_mode": "any",
                      "keyword_mode": "any",
                      "theme_mode": "any",
                      "developer_mode": "any",
                      "publisher_mode": "any",
                      "release_after": null,
                      "release_before": null,
                      "min_user_rating": 70,
                      "min_user_votes": null,
                      "min_critic_rating": null,
                      "min_critic_votes": null,
                      "sort": "name",
                      "descending": false,
                      "offset": 0,
                      "limit": 12,
                      "cursor_after": null
                    }
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::saved_filters",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user."
      },
      "post": {
        "operationId": "save_filter",
        "summary": "Save or replace a named filter",
        "description": "Trims name and applies the same 1–80 UTF-8 byte rule as list creation. Upserts by account/name, retaining the existing ID. Validates using the synthetic filter engine, so IGDB lookup/search constraints are checked only when searching. No scheduled refresh endpoint.",
        "tags": [
          "Filters"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedResult"
                },
                "example": {
                  "saved": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::save_filter",
        "parameters": [
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "x-account-mode": "A session or scoped API key is required in account mode; local demo uses the shared local user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveFilterRequest"
              },
              "example": {
                "name": "Example adventures",
                "filter": {
                  "genres": [
                    "Adventure"
                  ],
                  "genre_mode": "any",
                  "min_user_rating": 70,
                  "limit": 12,
                  "sort": "name",
                  "descending": false,
                  "offset": 0
                }
              }
            }
          }
        }
      }
    },
    "/api/filters/{id}": {
      "put": {
        "operationId": "update_filter",
        "summary": "Update an owned saved filter with an expected revision",
        "description": "Returns 404 for a missing or foreign ID and 409 for a stale revision or name collision. The revision fingerprints the stored name and exact filter JSON; a change that returns to identical content has the same fingerprint. Existing rules are never recreated by this operation.",
        "tags": [
          "Filters"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Owned saved-filter ID."
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFilterRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated saved filter and its new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedFilter"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::update_filter"
      },
      "delete": {
        "operationId": "delete_filter",
        "summary": "Delete an owned saved filter",
        "description": "Idempotently deletes an owned saved rule. Missing and other-account IDs return removed false.",
        "tags": [
          "Filters"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {
            "apiKeyBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Opaque saved-filter ID."
          },
          {
            "$ref": "#/components/parameters/DataOrigin"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the delete attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemovedResult"
                },
                "example": {
                  "removed": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "x-handler": "src/main.rs::delete_filter"
      }
    },
    "/.well-known/oauth-protected-resource/mcp": {
      "get": {
        "operationId": "resource",
        "summary": "Discover MCP protected resource",
        "description": "Requires MCP_ENABLED=1 and ACCOUNT_MODE=1; otherwise 503. No Host/Origin/auth checks on this metadata route. Values derive from the configured origin (APP_ORIGIN or APP_EXTRA_ORIGINS) whose host the request names, falling back to APP_ORIGIN. The same document is served at /.well-known/oauth-protected-resource and with a trailing slash.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                },
                "example": {
                  "resource": "http://127.0.0.1:8080/mcp",
                  "authorization_servers": [
                    "http://127.0.0.1:8080"
                  ],
                  "scopes_supported": [
                    "read",
                    "write"
                  ],
                  "bearer_methods_supported": [
                    "header"
                  ]
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::resource"
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "resource_root",
        "summary": "Discover MCP protected resource at the root well-known path",
        "description": "Requires MCP_ENABLED=1 and ACCOUNT_MODE=1; otherwise 503. No Host/Origin/auth checks on this metadata route. Values derive from the configured origin (APP_ORIGIN or APP_EXTRA_ORIGINS) whose host the request names, falling back to APP_ORIGIN. The same document is served at /.well-known/oauth-protected-resource and with a trailing slash.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                },
                "example": {
                  "resource": "http://127.0.0.1:8080/mcp",
                  "authorization_servers": [
                    "http://127.0.0.1:8080"
                  ],
                  "scopes_supported": [
                    "read",
                    "write"
                  ],
                  "bearer_methods_supported": [
                    "header"
                  ]
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::resource"
      }
    },
    "/.well-known/oauth-protected-resource/mcp/": {
      "get": {
        "operationId": "resource_trailing_slash",
        "summary": "Discover MCP protected resource with a trailing slash",
        "description": "Requires MCP_ENABLED=1 and ACCOUNT_MODE=1; otherwise 503. No Host/Origin/auth checks on this metadata route. Values derive from the configured origin (APP_ORIGIN or APP_EXTRA_ORIGINS) whose host the request names, falling back to APP_ORIGIN. The same document is served at /.well-known/oauth-protected-resource and with a trailing slash.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtectedResourceMetadata"
                },
                "example": {
                  "resource": "http://127.0.0.1:8080/mcp",
                  "authorization_servers": [
                    "http://127.0.0.1:8080"
                  ],
                  "scopes_supported": [
                    "read",
                    "write"
                  ],
                  "bearer_methods_supported": [
                    "header"
                  ]
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::resource"
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "metadata",
        "summary": "Discover the authorization server",
        "description": "Requires MCP and account mode; otherwise 503. No Host/Origin/auth checks. Issuer and endpoints use the configured origin the request host names. Public clients may register or use HTTPS client metadata documents. Client secrets, introspection and client-credentials grants are not supported. Also served at /.well-known/openid-configuration with the same OAuth fields.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorizationServerMetadata"
                },
                "example": {
                  "issuer": "http://127.0.0.1:8080",
                  "authorization_response_iss_parameter_supported": true,
                  "client_id_metadata_document_supported": true,
                  "authorization_endpoint": "http://127.0.0.1:8080/oauth/authorize",
                  "token_endpoint": "http://127.0.0.1:8080/oauth/token",
                  "registration_endpoint": "http://127.0.0.1:8080/oauth/register",
                  "revocation_endpoint": "http://127.0.0.1:8080/oauth/revoke",
                  "response_types_supported": [
                    "code"
                  ],
                  "grant_types_supported": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "token_endpoint_auth_methods_supported": [
                    "none"
                  ],
                  "code_challenge_methods_supported": [
                    "S256"
                  ],
                  "scopes_supported": [
                    "read",
                    "write"
                  ]
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::metadata"
      }
    },
    "/.well-known/openid-configuration": {
      "get": {
        "operationId": "openid_configuration",
        "summary": "Discover the authorization server (OpenID configuration alias)",
        "description": "Requires MCP and account mode; otherwise 503. No Host/Origin/auth checks. Issuer and endpoints use the configured origin the request host names. Public clients may register or use HTTPS client metadata documents. Client secrets, introspection and client-credentials grants are not supported. Also served at /.well-known/openid-configuration with the same OAuth fields.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorizationServerMetadata"
                },
                "example": {
                  "issuer": "http://127.0.0.1:8080",
                  "authorization_response_iss_parameter_supported": true,
                  "client_id_metadata_document_supported": true,
                  "authorization_endpoint": "http://127.0.0.1:8080/oauth/authorize",
                  "token_endpoint": "http://127.0.0.1:8080/oauth/token",
                  "registration_endpoint": "http://127.0.0.1:8080/oauth/register",
                  "revocation_endpoint": "http://127.0.0.1:8080/oauth/revoke",
                  "response_types_supported": [
                    "code"
                  ],
                  "grant_types_supported": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "token_endpoint_auth_methods_supported": [
                    "none"
                  ],
                  "code_challenge_methods_supported": [
                    "S256"
                  ],
                  "scopes_supported": [
                    "read",
                    "write"
                  ]
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::metadata"
      }
    },
    "/oauth/register": {
      "post": {
        "operationId": "register",
        "summary": "Register a public OAuth client",
        "description": "Registers up to 10 exact HTTPS or loopback HTTP redirect URIs. Public clients use PKCE S256; no client secret is issued. Registration is bounded and rate limited.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "redirect_uris"
                ],
                "properties": {
                  "client_name": {
                    "type": "string"
                  },
                  "redirect_uris": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "token_endpoint_auth_method": {
                    "type": "string",
                    "const": "none"
                  },
                  "response_types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "grant_types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered public client metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "client_id",
                    "client_id_issued_at",
                    "client_name",
                    "redirect_uris",
                    "token_endpoint_auth_method",
                    "response_types",
                    "grant_types"
                  ],
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "client_id_issued_at": {
                      "type": "integer"
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "redirect_uris": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "token_endpoint_auth_method": {
                      "type": "string",
                      "const": "none"
                    },
                    "response_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "grant_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "429": {
            "description": "Registration rate limit exceeded."
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::register"
      }
    },
    "/oauth/authorize": {
      "get": {
        "operationId": "authorize_request",
        "summary": "Render sign-in or account-bound consent",
        "description": "Browser authorization-code flow for registered or metadata document public clients. Redirects must match exactly. Query at most 8192 bytes; duplicate keys rejected. Omitted scope defaults to read; other values are validated before HTML. Without a valid session returns a sign-in form (200, not 401); on the Google sign-in host it offers Continue with Google above the password form, returning to this request. Omitted resource means the request host's /mcp; any other resource is 400 invalid_target. With a session creates a one-use account-bound pending consent expiring after 300 seconds and returns consent HTML. No automatic approval. Requires MCP and account mode.",
        "tags": [
          "OAuth"
        ],
        "security": [
          {
            "sessionCookie": []
          },
          {}
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                },
                "example": "<!doctype html><html lang=\"en\"><title>Game Lists authorization</title><body>Example authorization form</body></html>"
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "Content-Security-Policy": {
                "$ref": "#/components/headers/Csp"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::authorize_request",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          },
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "const": "code"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "const": "S256"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri",
              "description": "Optional; when present must equal the request host's configured origin + /mcp."
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 0,
              "maxLength": 512,
              "x-maxUtf8Bytes": 512
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "",
                "read",
                "read write",
                "write read"
              ]
            }
          }
        ]
      }
    },
    "/oauth/login": {
      "post": {
        "operationId": "oauth_login",
        "summary": "Sign in and return to authorization",
        "description": "Form-based login during authorization. Validates nested query, then shares /api/login account authentication, byte limits and in-memory limiter. Creates the same 24-hour cookie. On success sends 303 to /oauth/authorize with the normalized query; this does not yet issue a code or token.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "303": {
            "description": "See Other. Follow the Location header.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "Set-Cookie": {
                "$ref": "#/components/headers/SessionCookie"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "429": {
            "$ref": "#/components/responses/429"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::oauth_login",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OAuthLoginForm"
              }
            }
          }
        }
      }
    },
    "/oauth/consent": {
      "post": {
        "operationId": "consent",
        "summary": "Approve or deny pending OAuth access",
        "description": "Requires signed-in session and Origin. Pending request must belong to this account, remain unexpired, and be unused. approve consumes it and redirects with code, state and iss; deny consumes it and redirects with error=access_denied and state. Authorization code expires after 120 seconds and is one use. Helper errors become 400 Consent request expired.",
        "tags": [
          "OAuth"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "303": {
            "description": "See Other. Follow the Location header.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "422": {
            "$ref": "#/components/responses/422"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::consent",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "x-account-mode": "Cookie required when ACCOUNT_MODE=1; local-demo resolves to the shared local user without a cookie.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ConsentForm"
              },
              "example": {
                "request": "synthetic-pending-identifier",
                "decision": "deny"
              }
            }
          }
        }
      }
    },
    "/oauth/token": {
      "post": {
        "operationId": "token",
        "summary": "Exchange code or rotate a refresh token",
        "description": "Public client with PKCE S256; no HTTP Basic/client secret. Host checked; Origin optional but must match if sent. An omitted resource means the request host's /mcp; any other is invalid_target. Duplicate keys rejected; encoded body at most 8192 bytes. Returns application {error:string}, not error_description: invalid_target, unsupported_grant_type or invalid_grant (including helper DB errors). Access token lasts 3600 seconds, refresh token 30 days from each issuance. Every refresh rotates the refresh token. Replay revokes the entire family, including previously returned access tokens; old access tokens otherwise remain valid until expiry/revocation. Requested scope changes on refresh are ignored.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                },
                "example": {
                  "access_token": "EXAMPLE-NOT-A-VALID-ACCESS-TOKEN",
                  "token_type": "Bearer",
                  "expires_in": 3600,
                  "refresh_token": "EXAMPLE-NOT-A-VALID-REFRESH-TOKEN",
                  "scope": "read"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::token",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TokenForm"
              },
              "example": {
                "grant_type": "authorization_code",
                "client_id": "https://chatgpt.com/oauth/client.json",
                "resource": "http://127.0.0.1:8080/mcp",
                "code": "EXAMPLE-NOT-A-VALID-CODE",
                "redirect_uri": "https://chatgpt.com/connector_platform_oauth_redirect",
                "code_verifier": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ]
      }
    },
    "/oauth/revoke": {
      "post": {
        "operationId": "revoke",
        "summary": "Revoke an access or refresh token family",
        "description": "Requires the bound client_id, not session or client secret. Host checked; Origin optional. Known token revokes its entire family. Missing, unknown or revoked token still returns 200 {}. No OAuth token introspection. Encoded body at most 8192 bytes; duplicate keys rejected.",
        "tags": [
          "OAuth"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": false
                },
                "example": {}
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "500": {
            "$ref": "#/components/responses/500"
          },
          "503": {
            "$ref": "#/components/responses/503"
          }
        },
        "x-handler": "src/mcp.rs::revoke",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RevokeForm"
              },
              "example": {
                "client_id": "https://chatgpt.com/oauth/client.json",
                "token": "EXAMPLE-NOT-A-VALID-TOKEN"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ]
      }
    },
    "/mcp": {
      "post": {
        "operationId": "rpc_endpoint",
        "summary": "Send an MCP JSON-RPC message",
        "description": "Single POST JSON-RPC transport, not REST tools. Requires MCP and account mode; cookie alone is insufficient. Host checked; Origin optional but checked when present. Exact Authorization prefix is Bearer followed by a space. All messages, including initialize, tools/list, ping and notifications, require a valid grant. A read grant can read; write grant can read and mutate. Mutating tools require write scope. Insufficient scope returns an MCP tool error with a reauthorization challenge before dispatch. Valid envelopes without id return 202 with no body and are never dispatched (including unknown method/tool names). With id: initialize returns the requested protocolVersion (from params.protocolVersion or params._meta[\"io.modelcontextprotocol/protocolVersion\"]) when supported, otherwise 2025-11-25; server/discover returns the supported versions, capabilities, server info and instructions with resultType complete, ttlMs 3600000 and cacheScope public; tools/list returns the tool catalog; ping returns {}; tools/call returns JSON serialized inside a text content item. Invalid envelopes/batches return HTTP 200 error -32600; unknown methods -32601. Tool validation/provider/business failures return HTTP 200 result.isError=true. No GET/SSE transport, DELETE session endpoint, protocol-version header validation, sessions, resources or prompts interface.",
        "tags": [
          "MCP transport"
        ],
        "security": [
          {
            "mcpOAuth": [
              "read"
            ]
          },
          {
            "mcpBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpResponse"
                },
                "examples": {
                  "initialize": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 1,
                      "result": {
                        "protocolVersion": "2025-11-25",
                        "capabilities": {
                          "tools": {}
                        },
                        "serverInfo": {
                          "name": "game-lists",
                          "title": "Game Lists",
                          "version": "0.1.0"
                        },
                        "instructions": "Find games in the catalog and manage your own game lists, saved filters, ratings, reviews and completion history. Writes need the write scope."
                      }
                    }
                  },
                  "discover": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 2,
                      "result": {
                        "resultType": "complete",
                        "supportedVersions": [
                          "2026-07-28",
                          "2025-11-25",
                          "2025-06-18",
                          "2025-03-26",
                          "2024-11-05"
                        ],
                        "protocolVersions": [
                          "2026-07-28",
                          "2025-11-25",
                          "2025-06-18",
                          "2025-03-26",
                          "2024-11-05"
                        ],
                        "capabilities": {
                          "tools": {}
                        },
                        "_meta": {
                          "io.modelcontextprotocol/serverInfo": {
                            "name": "game-lists",
                            "title": "Game Lists",
                            "version": "0.1.0"
                          }
                        },
                        "serverInfo": {
                          "name": "game-lists",
                          "title": "Game Lists",
                          "version": "0.1.0"
                        },
                        "instructions": "Find games in the catalog and manage your own game lists, saved filters, ratings, reviews and completion history. Writes need the write scope.",
                        "ttlMs": 3600000,
                        "cacheScope": "public"
                      }
                    }
                  },
                  "ping": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 2,
                      "result": {}
                    }
                  },
                  "toolSuccess": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 3,
                      "result": {
                        "content": [
                          {
                            "type": "text",
                            "text": "{\"total\":1,\"games\":[{\"source\":\"synthetic\",\"id\":1,\"name\":\"Clockwork Orchard\",\"summary\":\"Explore a mechanical garden in this fictional example.\",\"cover_url\":null,\"platforms\":[\"Demo Console\",\"Example PC\"],\"genres\":[\"Adventure\"],\"keywords\":[\"exploration\"],\"themes\":[\"Fantasy\"],\"developer\":\"Example Studio\",\"publisher\":\"Example Publisher\",\"release_date\":1640995200,\"user_rating\":91.0,\"user_rating_count\":100,\"critic_rating\":78.0,\"critic_rating_count\":12}],\"facets\":{\"scope\":\"page\",\"platforms\":{\"Demo Console\":1,\"Example PC\":1},\"genres\":{\"Adventure\":1},\"themes\":{\"Fantasy\":1}}}"
                          }
                        ]
                      }
                    }
                  },
                  "toolFailure": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 4,
                      "result": {
                        "isError": true,
                        "content": [
                          {
                            "type": "text",
                            "text": "List not found"
                          }
                        ]
                      }
                    }
                  },
                  "unknownMethod": {
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 5,
                      "error": {
                        "code": -32601,
                        "message": "Method not found"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "description": "Sign in required or invalid credentials; at /mcp also an invalid, expired or revoked bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "$ref": "#/components/headers/Challenge"
              }
            }
          },
          "403": {
            "description": "Host not allowed or the request origin/cookies are not permitted for the transport. Host must match a configured origin authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "$ref": "#/components/headers/Challenge"
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "500": {
            "description": "Internal storage/session/auth operation unavailable. Error text is sanitized by handlers; some OAuth helpers map storage errors to 400.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "$ref": "#/components/headers/Challenge"
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/503"
          },
          "202": {
            "description": "Authenticated notification with no id; empty response body, no dispatch and no Cache-Control header."
          }
        },
        "x-handler": "src/mcp.rs::rpc_endpoint",
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalOrigin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpRequest"
              },
              "examples": {
                "initialize": {
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "initialize"
                  }
                },
                "listTools": {
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/list"
                  }
                },
                "search": {
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "tools/call",
                    "params": {
                      "name": "search_games",
                      "arguments": {
                        "genres": [
                          "Adventure"
                        ],
                        "genre_mode": "any",
                        "min_user_rating": 70,
                        "limit": 12,
                        "sort": "name",
                        "descending": false,
                        "offset": 0
                      }
                    }
                  }
                },
                "notification": {
                  "value": {
                    "jsonrpc": "2.0",
                    "method": "notifications/initialized"
                  }
                }
              }
            }
          }
        },
        "x-mcp-tools": [
          {
            "name": "get_history_finished_lists",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {},
              "additionalProperties": false
            },
            "decodedResult": {
              "$ref": "#/components/schemas/FinishedListSelection"
            },
            "relatedRestOperation": "GET /api/history/finished-lists"
          },
          {
            "name": "set_history_finished_lists",
            "scope": "write",
            "arguments": {
              "$ref": "#/components/schemas/FinishedListUpdate"
            },
            "decodedResult": {
              "$ref": "#/components/schemas/FinishedListSelection"
            },
            "relatedRestOperation": "PUT /api/history/finished-lists"
          },
          {
            "name": "list_history",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {},
              "additionalProperties": false
            },
            "decodedResult": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/HistoryEntry"
              }
            },
            "relatedRestOperation": "GET /api/history"
          },
          {
            "name": "get_completion",
            "scope": "read",
            "arguments": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "source",
                "game_id"
              ],
              "properties": {
                "source": {
                  "enum": [
                    "igdb",
                    "synthetic"
                  ]
                },
                "game_id": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "decodedResult": {
              "$ref": "#/components/schemas/CompletionDate"
            },
            "relatedRestOperation": "GET /api/completions/{source}/{game_id}"
          },
          {
            "name": "set_completion",
            "scope": "write",
            "arguments": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "source",
                "game_id",
                "completed_on"
              ],
              "properties": {
                "source": {
                  "enum": [
                    "igdb",
                    "synthetic"
                  ]
                },
                "game_id": {
                  "type": "integer",
                  "minimum": 1
                },
                "completed_on": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                }
              }
            },
            "decodedResult": {
              "$ref": "#/components/schemas/CompletionDate"
            },
            "relatedRestOperation": "PUT /api/completions/{source}/{game_id}"
          },
          {
            "name": "get_personal_rating",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {
                "source": {
                  "enum": [
                    "igdb",
                    "synthetic"
                  ]
                },
                "game_id": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": [
                "source",
                "game_id"
              ],
              "additionalProperties": false
            },
            "decodedResult": {
              "type": "object",
              "required": [
                "rating"
              ],
              "properties": {
                "rating": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 10
                }
              }
            },
            "relatedRestOperation": "GET /api/personal-ratings/{source}/{game_id}"
          },
          {
            "name": "set_personal_rating",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "source": {
                  "enum": [
                    "igdb",
                    "synthetic"
                  ]
                },
                "game_id": {
                  "type": "integer",
                  "minimum": 1
                },
                "rating": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 10
                }
              },
              "required": [
                "source",
                "game_id",
                "rating"
              ],
              "additionalProperties": false
            },
            "decodedResult": {
              "type": "object",
              "required": [
                "rating"
              ],
              "properties": {
                "rating": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 10
                }
              }
            },
            "relatedRestOperation": "PUT /api/personal-ratings/{source}/{game_id}"
          },
          {
            "name": "bulk_import",
            "scope": "write",
            "arguments": {
              "$ref": "#/components/schemas/BulkImport"
            },
            "decodedResult": {
              "$ref": "#/components/schemas/BulkReceipt"
            },
            "relatedRestOperation": "POST /api/imports"
          },
          {
            "name": "catalog_options",
            "scope": "read",
            "arguments": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "platforms",
                    "genres",
                    "themes",
                    "keywords",
                    "developers",
                    "publishers",
                    "series"
                  ]
                },
                "q": {
                  "type": "string",
                  "maxLength": 120
                },
                "after": {
                  "type": "integer",
                  "minimum": 0
                },
                "limit": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 50
                },
                "ids": {
                  "type": "string"
                }
              }
            },
            "decodedResult": {
              "$ref": "#/components/schemas/CatalogOptionsPage"
            },
            "relatedRestOperation": "GET /api/catalog/options"
          },
          {
            "name": "search_games",
            "scope": "read",
            "arguments": {
              "$ref": "#/components/schemas/Filter"
            },
            "decodedResult": {
              "$ref": "#/components/schemas/SearchResult"
            },
            "relatedRestOperation": "POST /api/games/search"
          },
          {
            "name": "game_details",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {
                "game_id": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": -9223372036854775808,
                  "maximum": 9223372036854775807
                }
              },
              "additionalProperties": false,
              "required": [
                "game_id"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/Game"
            },
            "relatedRestOperation": "GET /api/games/{id}"
          },
          {
            "name": "list_lists",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {},
              "additionalProperties": false
            },
            "decodedResult": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/McpList"
              }
            },
            "relatedRestOperation": "GET /api/lists"
          },
          {
            "name": "list_games",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id"
              ]
            },
            "decodedResult": {
              "type": "array",
              "items": {},
              "description": "Stored JSON values, normally Game objects. MCP reads parse Value rather than the REST Game type, so valid stored JSON is returned without Game shape validation."
            },
            "relatedRestOperation": "GET /api/lists/{id}/items"
          },
          {
            "name": "create_list",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "name"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/IdResult"
            },
            "relatedRestOperation": "POST /api/lists"
          },
          {
            "name": "rename_list",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id",
                "name"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/RenamedResult"
            },
            "relatedRestOperation": "PATCH /api/lists/{id}"
          },
          {
            "name": "delete_list",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/RemovedResult"
            },
            "relatedRestOperation": "DELETE /api/lists/{id}"
          },
          {
            "name": "add_game",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                },
                "game_id": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": -9223372036854775808,
                  "maximum": 9223372036854775807
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id",
                "game_id"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/AddedResult"
            },
            "relatedRestOperation": "POST /api/lists/{id}/items"
          },
          {
            "name": "remove_game",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "synthetic",
                    "igdb"
                  ]
                },
                "game_id": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": -9223372036854775808,
                  "maximum": 9223372036854775807
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id",
                "source",
                "game_id"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/RemovedResult"
            },
            "relatedRestOperation": "DELETE /api/lists/{id}/items/{source}/{game_id}"
          },
          {
            "name": "list_saved_filters",
            "scope": "read",
            "arguments": {
              "type": "object",
              "properties": {},
              "additionalProperties": false
            },
            "decodedResult": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/SavedFilter"
              }
            },
            "relatedRestOperation": "GET /api/filters"
          },
          {
            "name": "update_filter",
            "scope": "write",
            "arguments": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "filter_id",
                "name",
                "filter",
                "expected_revision"
              ],
              "properties": {
                "filter_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "filter": {
                  "$ref": "#/components/schemas/Filter"
                },
                "expected_revision": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              }
            },
            "decodedResult": {
              "$ref": "#/components/schemas/SavedFilter"
            },
            "relatedRestOperation": "PUT /api/filters/{id}"
          },
          {
            "name": "save_filter",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "filter": {
                  "$ref": "#/components/schemas/Filter"
                }
              },
              "additionalProperties": false,
              "required": [
                "name",
                "filter"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/SavedResult"
            },
            "relatedRestOperation": "POST /api/filters"
          },
          {
            "name": "delete_filter",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "filter_id": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "filter_id"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/RemovedResult"
            },
            "relatedRestOperation": "DELETE /api/filters/{id}"
          },
          {
            "name": "refresh_list",
            "scope": "write",
            "arguments": {
              "type": "object",
              "properties": {
                "list_id": {
                  "type": "string"
                },
                "filter": {
                  "$ref": "#/components/schemas/RefreshFilter"
                }
              },
              "additionalProperties": false,
              "required": [
                "list_id",
                "filter"
              ]
            },
            "decodedResult": {
              "$ref": "#/components/schemas/RefreshResult"
            },
            "relatedRestOperation": "POST /api/lists/{id}/refresh"
          }
        ],
        "x-mcp-tools-description": "These are JSON-RPC tool names, not HTTP routes. arguments documents runtime validation; tools/list advertises a smaller schema which omits some null/byte/conditional constraints. All tool argument objects reject extra keys. Filter applies deny_unknown_fields. All successful decodedResult values are JSON encoded inside result.content[0].text. list_lists has no count; no MCP saved-filter read or grant-management tool exists."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "User-created glk_ key for REST data routes. Read allows catalog and list reads including POST search; write also permits changes. Key management requires a browser session. OAuth and MCP use different credentials."
      },
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "gl_session",
        "description": "24-hour browser session created by /api/login or /oauth/login. Required on protected REST management routes when ACCOUNT_MODE=1. Data routes also accept an API key. Duplicate same-name cookie values invalidate the cookie."
      },
      "mcpBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Opaque 64-hex scoped MCP token; not a JWT. Only /mcp accepts it. write includes read; read cannot mutate. CLI-created legacy grants may have no OAuth family."
      },
      "mcpOAuth": {
        "type": "oauth2",
        "description": "MCP only. Fixed ChatGPT public client and exact redirect. PKCE S256 and resource=APP_ORIGIN/mcp required. Only scope strings read or read write accepted. OAuth refresh/revoke details are in their HTTP operations.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "/oauth/authorize",
            "tokenUrl": "/oauth/token",
            "refreshUrl": "/oauth/token",
            "scopes": {
              "read": "Read catalog and owned lists.",
              "write": "Read and modify owned lists and saved filters."
            }
          }
        }
      }
    },
    "parameters": {
      "DataOrigin": {
        "name": "Origin",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "description": "Required for session-authenticated writes, including POST search; optional for API key requests. If supplied, must match the configured origin corresponding to Host."
      },
      "Origin": {
        "name": "Origin",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "example": "http://127.0.0.1:8080",
        "description": "Must equal the configured origin corresponding to Host, without trailing slash. Required even for POST search. In default loopback mode localhost:8080 is also accepted when Host is localhost:8080."
      },
      "OptionalOrigin": {
        "name": "Origin",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "description": "If supplied, must exactly match the configured origin corresponding to Host (with the documented default localhost exception). Host is also checked."
      },
      "ListId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "00000000-0000-4000-8000-000000000001",
        "description": "Opaque owned list ID; server-generated UUIDs. The path parser does not enforce UUID syntax."
      },
      "GameId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64",
          "minimum": -9223372036854775808,
          "maximum": 9223372036854775807
        },
        "example": 1,
        "description": "Signed 64-bit catalog ID. Synthetic not found is 404; missing/invalid ID in IGDB mode is mapped to 503."
      },
      "ItemGameId": {
        "name": "game_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64",
          "minimum": -9223372036854775808,
          "maximum": 9223372036854775807
        },
        "example": 1
      },
      "Source": {
        "name": "source",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "synthetic",
        "description": "Stored source namespace. REST accepts arbitrary text; an unknown source just removes nothing. MCP remove_game restricts this to synthetic or igdb."
      },
      "Family": {
        "name": "family",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{64}$"
        },
        "example": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
        "description": "Non-secret family ID from GET /api/grants. Invalid shape gives 400; a well-formed unknown or other-account family gives 404."
      }
    },
    "headers": {
      "NoStore": {
        "description": "This successful response is not cacheable.",
        "schema": {
          "type": "string",
          "const": "no-store"
        }
      },
      "SessionCookie": {
        "description": "gl_session opaque secret; HttpOnly; SameSite=Lax; Path=/; Max-Age=86400; Secure added for HTTPS. Logout clears it with Max-Age=0, without Secure.",
        "schema": {
          "type": "string"
        }
      },
      "Location": {
        "description": "303 redirect location.",
        "schema": {
          "type": "string"
        }
      },
      "Challenge": {
        "description": "Bearer resource_metadata=\"ORIGIN/.well-known/oauth-protected-resource\", scope=\"read\", where ORIGIN is the configured origin the request host names. Added for bearer/host/origin verification failures at /mcp.",
        "schema": {
          "type": "string"
        }
      },
      "Csp": {
        "description": "Sign-in allows form submission to self. Consent also permits the registered redirect origin; default-src, base-uri and frame-ancestors remain 'none'.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "FinishedListUpdate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "list_ids",
          "expected_list_ids"
        ],
        "properties": {
          "list_ids": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "expected_list_ids": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        }
      },
      "FinishedListSelection": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "list_ids"
        ],
        "properties": {
          "list_ids": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        }
      },
      "HistoryEntry": {
        "type": "object",
        "required": [
          "game",
          "completed_on"
        ],
        "properties": {
          "game": {
            "$ref": "#/components/schemas/Game"
          },
          "completed_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          }
        }
      },
      "CompletionDate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "completed_on"
        ],
        "properties": {
          "completed_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "A real Gregorian calendar date in YYYY-MM-DD, with year 0001–9999, or null."
          }
        }
      },
      "BulkImport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "idempotency_key",
          "items"
        ],
        "properties": {
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/BulkItem"
            }
          }
        }
      },
      "BulkItem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "list_id",
          "game_id"
        ],
        "properties": {
          "list_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "game_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9223372036854775807
          }
        }
      },
      "BulkReceipt": {
        "type": "object",
        "required": [
          "committed",
          "items"
        ],
        "properties": {
          "committed": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "list_id",
                "game_id",
                "status"
              ],
              "properties": {
                "list_id": {
                  "type": "string"
                },
                "game_id": {
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "added",
                    "already_present",
                    "not_found",
                    "retryable_error"
                  ]
                }
              }
            }
          }
        }
      },
      "ApiKeySummary": {
        "type": "object",
        "required": [
          "id",
          "name",
          "scope",
          "created_at",
          "expires_at",
          "revoked_at"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "read",
              "write"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "expires_at": {
            "type": "integer"
          },
          "revoked_at": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "ApiKeyCreateRequest": {
        "type": "object",
        "required": [
          "name",
          "scope"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Trimmed; at most 80 UTF-8 bytes and no control characters."
          },
          "scope": {
            "type": "string",
            "enum": [
              "read",
              "write"
            ]
          }
        }
      },
      "ApiKeyCreateResponse": {
        "type": "object",
        "required": [
          "key",
          "token"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "$ref": "#/components/schemas/ApiKeySummary"
          },
          "token": {
            "type": "string",
            "description": "One-time secret; never returned again."
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "description": "Application errors use this JSON envelope. Extractor and router errors can instead be plain text.",
        "required": [
          "error"
        ]
      },
      "Game": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "description": "Catalog namespace. Current catalog values are synthetic or igdb; stored entries retain their original source."
          },
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          },
          "name": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "cover_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "genres": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "themes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "series": {
            "type": [
              "array",
              "null"
            ],
            "description": "IGDB collections, distinct from franchises; null when an older snapshot lacks series data.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "integer",
                  "minimum": 1
                },
                "name": {
                  "type": "string"
                },
                "provider_type": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Optional IGDB collection type label."
                }
              }
            }
          },
          "developer": {
            "type": "string",
            "description": "Company names joined by comma-space; may be empty."
          },
          "publisher": {
            "type": "string",
            "description": "Company names joined by comma-space; may be empty."
          },
          "release_date": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Unix seconds; null when unknown."
          },
          "user_rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "user_rating_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          },
          "critic_rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "critic_rating_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          }
        },
        "additionalProperties": false,
        "description": "Catalog data, not user-entered scores. All keys are serialized, including nulls. Scores conventionally use 0–100; provider output is not range-validated by the mapper. Personal ratings are returned by the separate personal-ratings endpoint.",
        "required": [
          "source",
          "id",
          "name",
          "summary",
          "cover_url",
          "platforms",
          "genres",
          "keywords",
          "themes",
          "developer",
          "publisher",
          "release_date",
          "user_rating",
          "user_rating_count",
          "critic_rating",
          "critic_rating_count"
        ],
        "examples": [
          {
            "source": "synthetic",
            "id": 1,
            "name": "Clockwork Orchard",
            "summary": "Explore a mechanical garden in this fictional example.",
            "cover_url": null,
            "platforms": [
              "Demo Console",
              "Example PC"
            ],
            "genres": [
              "Adventure"
            ],
            "keywords": [
              "exploration"
            ],
            "themes": [
              "Fantasy"
            ],
            "developer": "Example Studio",
            "publisher": "Example Publisher",
            "release_date": 1640995200,
            "user_rating": 91.0,
            "user_rating_count": 100,
            "critic_rating": 78.0,
            "critic_rating_count": 12
          }
        ]
      },
      "CatalogOptionsPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "next_after"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "integer",
                  "minimum": 1
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "next_after": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          }
        }
      },
      "CategoryName": {
        "type": "string",
        "maxLength": 120,
        "allOf": [
          {
            "pattern": "\\S"
          },
          {
            "not": {
              "pattern": "[\"\\\\\\u0000-\\u001f\\u007f-\\u009f]"
            }
          }
        ],
        "x-maxUtf8Bytes": 120,
        "description": "Nonblank after trimming; at most 120 UTF-8 bytes before trimming. No control characters, double quotes or backslashes. Name matching is exact, case-insensitive, and trimmed."
      },
      "Filter": {
        "type": "object",
        "properties": {
          "include_list_ids": {
            "type": "array",
            "maxItems": 20,
            "default": [],
            "description": "Match games on any selected owned list. An empty selection imposes no inclusion restriction.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "x-maxUtf8Bytes": 128,
              "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
            }
          },
          "exclude_list_ids": {
            "type": "array",
            "maxItems": 20,
            "default": [],
            "description": "Exclude games on any selected owned list. Exclusion wins when a game matches both sides.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "x-maxUtf8Bytes": 128,
              "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
            }
          },
          "series_name": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ]
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "series_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9223372036854775807
            },
            "maxItems": 8,
            "default": []
          },
          "series_mode": {
            "enum": [
              "any",
              "all"
            ],
            "default": "any"
          },
          "search": {
            "type": [
              "string",
              "null"
            ],
            "description": "Synthetic mode: case-insensitive substring of name, with no length or character validation. IGDB: case-insensitive title substring filter, compatible with sorting and refresh; blank is omitted; nonblank is trimmed and must be at most 120 UTF-8 bytes with no controls, double quotes or backslashes. Invalid IGDB search text returns 503."
          },
          "platform": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty platforms array."
          },
          "genre": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty genres array."
          },
          "keyword": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty keywords array."
          },
          "theme": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty themes array."
          },
          "developer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty developers array."
          },
          "publisher": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty publishers array."
          },
          "platforms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "genres": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "keywords": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "themes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "developers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "publishers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "platform_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "genre_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "keyword_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "theme_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "developer_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "publisher_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "platform_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within platforms. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "genre_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within genres. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "keyword_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within keywords. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "theme_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within themes. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "developer_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within developers. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "publisher_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within publishers. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "release_after": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Inclusive minimum release time in Unix seconds. Must be <= release_before when both exist."
          },
          "release_before": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Inclusive maximum release time in Unix seconds."
          },
          "min_user_rating": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "min_user_votes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "min_critic_rating": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "min_critic_votes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "sort": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "id",
              "name",
              "release_date",
              "user_rating",
              "critic_rating",
              null
            ],
            "default": "name"
          },
          "descending": {
            "type": "boolean",
            "default": false
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 18446744073709551615,
            "default": 0,
            "description": "Zero-based number of matches to skip. Rust usize on supported 64-bit targets. No smaller application maximum. Must be zero when cursor_after is set."
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100,
            "default": 24,
            "description": "Omitted or null means 24."
          },
          "cursor_after": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036854775807,
            "description": "Exclusive ID lower bound, independent of sort direction. For sequential scans use sort=id, descending=false and offset=0. total is counted after this bound, before offset/limit. No next-cursor response field."
          }
        },
        "additionalProperties": false,
        "allOf": [
          {
            "not": {
              "required": [
                "series_name",
                "series"
              ],
              "properties": {
                "series_name": {
                  "type": "string"
                },
                "series": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "series_name",
                "series_ids"
              ],
              "properties": {
                "series_name": {
                  "type": "string"
                },
                "series_ids": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "platform",
                "platforms"
              ],
              "properties": {
                "platform": {
                  "type": "string"
                },
                "platforms": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "genre",
                "genres"
              ],
              "properties": {
                "genre": {
                  "type": "string"
                },
                "genres": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "keyword",
                "keywords"
              ],
              "properties": {
                "keyword": {
                  "type": "string"
                },
                "keywords": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "theme",
                "themes"
              ],
              "properties": {
                "theme": {
                  "type": "string"
                },
                "themes": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "developer",
                "developers"
              ],
              "properties": {
                "developer": {
                  "type": "string"
                },
                "developers": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "publisher",
                "publishers"
              ],
              "properties": {
                "publisher": {
                  "type": "string"
                },
                "publishers": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "cursor_after",
                "offset"
              ],
              "properties": {
                "cursor_after": {
                  "type": "integer"
                },
                "offset": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        ],
        "description": "All fields optional; unknown properties are rejected. Null is accepted only for Option fields, not arrays, match modes, descending or offset. Missing arrays default to [], modes to any, offset to 0, descending to false. Numeric/date filters exclude games with unknown values. Synthetic sorting breaks ties with ID; descending reverses the complete ordering. Provider sorting/ties follow IGDB. See README for cross-field and byte limits.",
        "examples": [
          {},
          {
            "genres": [
              "Adventure"
            ],
            "genre_mode": "any",
            "min_user_rating": 70,
            "limit": 12,
            "sort": "name",
            "descending": false,
            "offset": 0
          },
          {
            "sort": "id",
            "limit": 100,
            "cursor_after": 1
          },
          {
            "platform": null,
            "platforms": [],
            "limit": null
          }
        ]
      },
      "RefreshFilter": {
        "type": "object",
        "properties": {
          "include_list_ids": {
            "type": "array",
            "maxItems": 20,
            "default": [],
            "description": "Match games on any selected owned list. An empty selection imposes no inclusion restriction.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "x-maxUtf8Bytes": 128,
              "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
            }
          },
          "exclude_list_ids": {
            "type": "array",
            "maxItems": 20,
            "default": [],
            "description": "Exclude games on any selected owned list. Exclusion wins when a game matches both sides.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "x-maxUtf8Bytes": 128,
              "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
            }
          },
          "series_name": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ]
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "series_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9223372036854775807
            },
            "maxItems": 8,
            "default": []
          },
          "series_mode": {
            "enum": [
              "any",
              "all"
            ],
            "default": "any"
          },
          "search": {
            "type": [
              "string",
              "null"
            ],
            "description": "Synthetic mode: case-insensitive substring of name, with no length or character validation. IGDB: case-insensitive title substring filter, compatible with sorting and refresh; blank is omitted; nonblank is trimmed and must be at most 120 UTF-8 bytes with no controls, double quotes or backslashes. Invalid IGDB search text returns 503."
          },
          "platform": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty platforms array."
          },
          "genre": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty genres array."
          },
          "keyword": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty keywords array."
          },
          "theme": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty themes array."
          },
          "developer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty developers array."
          },
          "publisher": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CategoryName"
              },
              {
                "type": "null"
              }
            ],
            "description": "Legacy exact single name; cannot coexist with a nonempty publishers array."
          },
          "platforms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "genres": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "keywords": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "themes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "developers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "publishers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryName"
            },
            "maxItems": 8,
            "default": []
          },
          "platform_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "genre_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "keyword_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "theme_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "developer_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "publisher_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "maxItems": 8,
            "default": [],
            "description": "Provider-specific IDs; at most eight IDs and names combined in this category."
          },
          "platform_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within platforms. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "genre_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within genres. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "keyword_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within keywords. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "theme_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within themes. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "developer_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within developers. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "publisher_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ],
            "default": "any",
            "description": "Match within publishers. Different filter fields are combined with AND. No effect when that array is empty."
          },
          "release_after": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Inclusive minimum release time in Unix seconds. Must be <= release_before when both exist."
          },
          "release_before": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Inclusive maximum release time in Unix seconds."
          },
          "min_user_rating": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "min_user_votes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "min_critic_rating": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "min_critic_votes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "sort": {
            "type": [
              "string",
              "null"
            ],
            "description": "Deserialized for type correctness, then ignored and replaced during refresh."
          },
          "descending": {
            "type": "boolean",
            "description": "Deserialized for type correctness, then ignored and replaced during refresh."
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 18446744073709551615,
            "description": "Deserialized for type correctness, then ignored and replaced during refresh."
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 18446744073709551615,
            "description": "Deserialized for type correctness, then ignored and replaced during refresh."
          },
          "cursor_after": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807,
            "description": "Deserialized for type correctness, then ignored and replaced during refresh."
          }
        },
        "additionalProperties": false,
        "allOf": [
          {
            "not": {
              "required": [
                "series_name",
                "series"
              ],
              "properties": {
                "series_name": {
                  "type": "string"
                },
                "series": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "series_name",
                "series_ids"
              ],
              "properties": {
                "series_name": {
                  "type": "string"
                },
                "series_ids": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "platform",
                "platforms"
              ],
              "properties": {
                "platform": {
                  "type": "string"
                },
                "platforms": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "genre",
                "genres"
              ],
              "properties": {
                "genre": {
                  "type": "string"
                },
                "genres": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "keyword",
                "keywords"
              ],
              "properties": {
                "keyword": {
                  "type": "string"
                },
                "keywords": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "theme",
                "themes"
              ],
              "properties": {
                "theme": {
                  "type": "string"
                },
                "themes": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "developer",
                "developers"
              ],
              "properties": {
                "developer": {
                  "type": "string"
                },
                "developers": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          },
          {
            "not": {
              "required": [
                "publisher",
                "publishers"
              ],
              "properties": {
                "publisher": {
                  "type": "string"
                },
                "publishers": {
                  "type": "array",
                  "minItems": 1
                }
              }
            }
          }
        ],
        "description": "Same matching fields as Filter, but pagination/sort values are replaced before semantic validation: offset=0, limit=100, sort=id, descending=false, cursor_after=null. Even an unsupported sort or limit=0 is ignored. Unknown keys and wrong field types still fail extraction. Shared matching validation returns 400 in synthetic mode and is mapped to 503 by the IGDB refresh preparation path.",
        "examples": [
          {
            "genres": [
              "Adventure"
            ],
            "limit": 0,
            "sort": "ignored",
            "offset": 99,
            "cursor_after": -1
          }
        ]
      },
      "PageFacets": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "const": "page"
          },
          "platforms": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "genres": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "themes": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "additionalProperties": false,
        "description": "Counts unique occurrences per game on this response page, not the entire result set. No keyword or company facets.",
        "required": [
          "scope",
          "platforms",
          "genres",
          "themes"
        ]
      },
      "MatchingFacets": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "const": "matching"
          },
          "platforms": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "genres": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "themes": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "required": [
          "scope",
          "platforms",
          "genres",
          "themes"
        ],
        "additionalProperties": false,
        "description": "Counts across the complete matching set for providers that can calculate them without a catalog scan."
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "games": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Game"
            }
          },
          "facets": {
            "$ref": "#/components/schemas/PageFacets"
          },
          "matching_facets": {
            "$ref": "#/components/schemas/MatchingFacets"
          }
        },
        "additionalProperties": false,
        "description": "matching_facets is present only where full matching counts are available; facets remains page-scoped. total is matching games after cursor filtering and before offset/limit. A page can be empty while total is positive.",
        "required": [
          "total",
          "games",
          "facets"
        ]
      },
      "List": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "built_in": {
            "type": "boolean",
            "description": "Backlog and Played are provisioned by default; existing Favorites remains protected."
          },
          "preview": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/ListPreview"
            },
            "description": "Up to four most recently added entries, newest first."
          }
        },
        "additionalProperties": false,
        "description": "One owned list and its number of entries across sources. Returned in name order.",
        "required": [
          "id",
          "name",
          "count",
          "built_in",
          "preview"
        ]
      },
      "ListPreview": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          },
          "name": {
            "type": "string",
            "description": "Stored game name, or an empty string when the stored entry has none."
          },
          "cover_url": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^https://images\\.igdb\\.com/igdb/image/upload/",
            "description": "Stored IGDB cover image; other stored URLs are omitted as null."
          }
        },
        "additionalProperties": false,
        "description": "A lightweight reference to a list entry for list cards.",
        "required": [
          "source",
          "id",
          "name",
          "cover_url"
        ]
      },
      "Membership": {
        "type": "object",
        "properties": {
          "list_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "game_id": {
            "type": "integer",
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          },
          "personal_rating": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 10
          }
        },
        "additionalProperties": false,
        "description": "One source-qualified game in one owned list.",
        "required": [
          "list_id",
          "source",
          "game_id",
          "personal_rating"
        ]
      },
      "ListNameRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Trimmed before storage; trimmed value must be nonempty and at most 80 UTF-8 bytes. Surrounding whitespace is not counted."
          }
        },
        "additionalProperties": true,
        "description": "Unknown JSON properties are ignored by this Rust request type.",
        "required": [
          "name"
        ]
      },
      "LoginRequest": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string",
            "writeOnly": true
          }
        },
        "additionalProperties": true,
        "description": "Exact stored username and password. No trimming or case normalization during authentication. More than 64 username bytes or 1024 password bytes returns 401. Accounts are provisioned by CLI, not a signup endpoint. Unknown keys are ignored.",
        "required": [
          "username",
          "password"
        ]
      },
      "AddGameRequest": {
        "type": "object",
        "properties": {
          "game_id": {
            "type": "integer",
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          }
        },
        "additionalProperties": true,
        "description": "Fetches from the currently configured catalog. source is not a caller-selected provider; unknown keys are ignored. Nonpositive IDs give 404 in synthetic mode or 503 in IGDB mode.",
        "required": [
          "game_id"
        ]
      },
      "SaveFilterRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "filter": {
            "$ref": "#/components/schemas/Filter"
          }
        },
        "additionalProperties": true,
        "description": "Name validation is the same as list creation. Unknown outer keys are ignored; unknown filter keys are rejected. Upserts by account and trimmed name, retaining the existing ID. Validation is local and does not verify IGDB names or search text.",
        "required": [
          "name",
          "filter"
        ]
      },
      "UpdateFilterRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "filter",
          "expected_revision"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "filter": {
            "$ref": "#/components/schemas/Filter"
          },
          "expected_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "SavedFilter": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque fingerprint for conditional updates."
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "filter": {
            "description": "Parsed stored JSON, normally a Filter with all defaults serialized. Read handler parses Value rather than revalidating Filter, so other valid legacy/stored JSON is returned verbatim.",
            "x-normal-schema": {
              "$ref": "#/components/schemas/Filter"
            }
          }
        },
        "additionalProperties": false,
        "description": "Stored filter serialized with Rust defaults during normal writes. Malformed stored JSON rows are silently omitted. Ordered by name; no pagination.",
        "required": [
          "id",
          "name",
          "filter",
          "revision"
        ]
      },
      "IdResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "id"
        ]
      },
      "AddedResult": {
        "type": "object",
        "properties": {
          "added": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "required": [
          "added"
        ]
      },
      "RenamedResult": {
        "type": "object",
        "properties": {
          "renamed": {
            "type": "boolean"
          }
        },
        "required": [
          "renamed"
        ],
        "additionalProperties": false
      },
      "RemovedResult": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "required": [
          "removed"
        ]
      },
      "SavedResult": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "required": [
          "saved"
        ]
      },
      "RevokedResult": {
        "type": "object",
        "properties": {
          "revoked": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "required": [
          "revoked"
        ]
      },
      "Signed_InResult": {
        "type": "object",
        "properties": {
          "signed_in": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "required": [
          "signed_in"
        ]
      },
      "RefreshResult": {
        "type": "object",
        "properties": {
          "added": {
            "type": "integer",
            "minimum": 0
          },
          "matched": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5000
          }
        },
        "additionalProperties": false,
        "description": "matched is the complete matching scan; added counts new entries only. Existing entries and snapshots remain; no deletion or automatic refresh.",
        "required": [
          "added",
          "matched"
        ]
      },
      "SessionStatus": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "demo",
              "accounts"
            ]
          },
          "signed_in": {
            "type": "boolean"
          },
          "username": {
            "type": "string",
            "minLength": 3,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "Present only for a valid account-mode session."
          }
        },
        "additionalProperties": false,
        "description": "Demo always reports signed_in=true; account mode checks the session cookie without requiring a valid session.",
        "required": [
          "mode",
          "signed_in"
        ]
      },
      "ProviderStatus": {
        "type": "object",
        "properties": {
          "google_sign_in": {
            "type": "boolean",
            "description": "Whether Google sign-in is configured on this allowed origin."
          },
          "provider": {
            "type": "string",
            "enum": [
              "synthetic",
              "igdb"
            ]
          },
          "message": {
            "type": "string"
          },
          "mcp": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "accounts",
              "local-demo"
            ]
          }
        },
        "additionalProperties": false,
        "description": "Configuration status only. Does not test IGDB connectivity or return provider credentials.",
        "required": [
          "provider",
          "message",
          "mcp",
          "mode",
          "google_sign_in"
        ]
      },
      "HealthReady": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "ok"
          },
          "release": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "status",
          "release"
        ]
      },
      "HealthUnready": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "unready"
          }
        },
        "additionalProperties": false,
        "required": [
          "status"
        ]
      },
      "GrantSummary": {
        "type": "object",
        "properties": {
          "family": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{64}$",
            "description": "Non-secret family identifier; never an access/refresh token."
          },
          "client": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "read",
              "read write"
            ]
          },
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "minimum": -9223372036854775808,
            "maximum": 9223372036854775807
          },
          "active": {
            "type": "boolean"
          }
        },
        "additionalProperties": false,
        "description": "Owned OAuth refresh-token family; ordered by latest expiry descending. expires_at is maximum refresh expiry in Unix seconds. active means at least one unrevoked, unexpired refresh token, not current access-token validity. Includes inactive families.",
        "required": [
          "family",
          "client",
          "scope",
          "expires_at",
          "active"
        ]
      },
      "OAuthAuthorizationQuery": {
        "type": "object",
        "properties": {
          "response_type": {
            "type": "string",
            "const": "code"
          },
          "code_challenge_method": {
            "type": "string",
            "const": "S256"
          },
          "resource": {
            "type": "string",
            "format": "uri",
            "description": "Optional; when present must equal the request host's configured origin + /mcp."
          },
          "client_id": {
            "type": "string",
            "maxLength": 2048
          },
          "redirect_uri": {
            "type": "string",
            "format": "uri"
          },
          "code_challenge": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "state": {
            "type": "string",
            "minLength": 0,
            "maxLength": 512,
            "x-maxUtf8Bytes": 512
          },
          "scope": {
            "type": "string",
            "enum": [
              "",
              "read",
              "read write",
              "write read"
            ]
          }
        },
        "additionalProperties": true,
        "description": "URL-encoded query; scope is optional and defaults to read; state is optional. Other listed fields are required. Unknown names are ignored, but duplicate names of any kind are rejected. Encoded query must be at most 8192 bytes; state at most 512 UTF-8 bytes.",
        "required": [
          "response_type",
          "code_challenge_method",
          "client_id",
          "redirect_uri",
          "code_challenge"
        ],
        "examples": [
          {
            "response_type": "code",
            "code_challenge_method": "S256",
            "resource": "http://127.0.0.1:8080/mcp",
            "client_id": "https://chatgpt.com/oauth/client.json",
            "redirect_uri": "https://chatgpt.com/connector_platform_oauth_redirect",
            "code_challenge": "DwBzhbb51LfusnSGBa_hqYSgo7-j8BTQnip4TOnlzRo",
            "state": "synthetic-example-state",
            "scope": "read"
          }
        ]
      },
      "ConsentForm": {
        "type": "object",
        "properties": {
          "request": {
            "type": "string"
          },
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "deny"
            ]
          }
        },
        "additionalProperties": true,
        "description": "request is the opaque pending identifier from the authorization HTML. Bound to the signed-in account, single-use and expires after 300 seconds. Unknown form fields ignored.",
        "required": [
          "request",
          "decision"
        ]
      },
      "OAuthLoginForm": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string",
            "writeOnly": true
          },
          "query": {
            "type": "string",
            "description": "The complete URL-encoded authorization query from the rendered form, at most 8192 bytes; not a URL. Validated before login."
          }
        },
        "additionalProperties": true,
        "required": [
          "username",
          "password",
          "query"
        ]
      },
      "AuthorizationCodeForm": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "const": "authorization_code"
          },
          "client_id": {
            "type": "string",
            "maxLength": 2048
          },
          "resource": {
            "type": "string",
            "format": "uri",
            "description": "Optional; when present must equal the request host's configured origin + /mcp."
          },
          "code": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string",
            "format": "uri"
          },
          "code_verifier": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._~-]{43,128}$"
          }
        },
        "additionalProperties": true,
        "required": [
          "grant_type",
          "client_id",
          "code",
          "redirect_uri",
          "code_verifier"
        ]
      },
      "RefreshTokenForm": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "const": "refresh_token"
          },
          "client_id": {
            "type": "string",
            "maxLength": 2048
          },
          "resource": {
            "type": "string",
            "format": "uri",
            "description": "Optional; when present must equal the request host's configured origin + /mcp."
          },
          "refresh_token": {
            "type": "string"
          }
        },
        "additionalProperties": true,
        "required": [
          "grant_type",
          "client_id",
          "refresh_token"
        ]
      },
      "TokenForm": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AuthorizationCodeForm"
          },
          {
            "$ref": "#/components/schemas/RefreshTokenForm"
          }
        ],
        "description": "URL-encoded, at most 8192 raw bytes. Unknown keys ignored; duplicate keys rejected. Public clients: no client secret. Missing required parameters are treated as empty by the handler and return 400."
      },
      "TokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "description": "Opaque secret; never a JWT."
          },
          "token_type": {
            "type": "string",
            "const": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "const": 3600
          },
          "refresh_token": {
            "type": "string",
            "description": "Opaque secret; rotate on every use."
          },
          "scope": {
            "type": "string",
            "enum": [
              "read",
              "read write"
            ]
          }
        },
        "additionalProperties": false,
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "refresh_token",
          "scope"
        ]
      },
      "RevokeForm": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string",
            "maxLength": 2048
          },
          "token": {
            "type": "string"
          }
        },
        "additionalProperties": true,
        "description": "At most 8192 URL-encoded bytes, no duplicate names. Missing token is treated as empty and succeeds. Unknown, missing or previously revoked token succeeds with {}. Known token revokes its entire family. token_type_hint, if sent, is ignored.",
        "required": [
          "client_id"
        ]
      },
      "ProtectedResourceMetadata": {
        "type": "object",
        "properties": {
          "resource": {
            "type": "string",
            "format": "uri"
          },
          "authorization_servers": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "minItems": 1,
            "maxItems": 1
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bearer_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "required": [
          "resource",
          "authorization_servers",
          "scopes_supported",
          "bearer_methods_supported"
        ]
      },
      "AuthorizationServerMetadata": {
        "type": "object",
        "properties": {
          "authorization_response_iss_parameter_supported": {
            "type": "boolean",
            "const": true
          },
          "client_id_metadata_document_supported": {
            "type": "boolean",
            "const": true
          },
          "issuer": {
            "type": "string",
            "format": "uri"
          },
          "authorization_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "token_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "revocation_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "registration_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "required": [
          "issuer",
          "authorization_response_iss_parameter_supported",
          "client_id_metadata_document_supported",
          "authorization_endpoint",
          "token_endpoint",
          "revocation_endpoint",
          "registration_endpoint",
          "response_types_supported",
          "grant_types_supported",
          "token_endpoint_auth_methods_supported",
          "code_challenge_methods_supported",
          "scopes_supported"
        ]
      },
      "McpRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "method": {
            "type": "string",
            "minLength": 1
          },
          "params": {}
        },
        "additionalProperties": true,
        "description": "Documented valid JSON-RPC envelope; id omitted means notification. The handler extracts any JSON value and returns an HTTP-200 JSON-RPC error for invalid envelopes/batches. Method names are not restricted: unknown methods with an id return -32601. params/arguments are validated by dispatch. No REST operation is implied by a tool name.",
        "required": [
          "jsonrpc",
          "method"
        ]
      },
      "McpResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "jsonrpc": {
                "type": "string",
                "const": "2.0"
              },
              "id": {
                "type": [
                  "string",
                  "number",
                  "null"
                ]
              },
              "result": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/McpInitializeResult"
                  },
                  {
                    "$ref": "#/components/schemas/McpDiscoverResult"
                  },
                  {
                    "$ref": "#/components/schemas/McpToolsListResult"
                  },
                  {
                    "$ref": "#/components/schemas/McpTextResult"
                  },
                  {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": false
                  }
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "jsonrpc",
              "id",
              "result"
            ]
          },
          {
            "type": "object",
            "properties": {
              "jsonrpc": {
                "type": "string",
                "const": "2.0"
              },
              "id": {
                "type": [
                  "string",
                  "number",
                  "null"
                ]
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      -32600,
                      -32601
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "jsonrpc",
              "id",
              "error"
            ]
          }
        ]
      },
      "McpTextResult": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "text"
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "type",
                "text"
              ]
            },
            "minItems": 1,
            "maxItems": 1
          },
          "isError": {
            "type": "boolean"
          },
          "_meta": {
            "type": "object",
            "additionalProperties": true,
            "description": "May contain mcp/www_authenticate challenges for scope escalation."
          }
        },
        "additionalProperties": false,
        "description": "Successful tool content is one text item containing serialized JSON. Tool failures set isError=true and return a plain error message in text, still inside HTTP 200 result.",
        "required": [
          "content"
        ]
      },
      "McpList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "description": "MCP list_lists result omits the REST count field.",
        "required": [
          "id",
          "name"
        ]
      },
      "McpTool": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "securitySchemes": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "_meta": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "description",
          "inputSchema",
          "securitySchemes",
          "_meta"
        ]
      },
      "McpInitializeResult": {
        "type": "object",
        "properties": {
          "protocolVersion": {
            "type": "string",
            "enum": [
              "2026-07-28",
              "2025-11-25",
              "2025-06-18",
              "2025-03-26",
              "2024-11-05"
            ]
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "tools": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            },
            "additionalProperties": false,
            "required": [
              "tools"
            ]
          },
          "serverInfo": {
            "$ref": "#/components/schemas/McpServerInfo"
          },
          "instructions": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "protocolVersion",
          "capabilities",
          "serverInfo"
        ]
      },
      "McpServerInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "game-lists"
          },
          "title": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "const": "0.1.0"
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "version"
        ]
      },
      "McpDiscoverResult": {
        "type": "object",
        "properties": {
          "resultType": {
            "type": "string",
            "const": "complete"
          },
          "supportedVersions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "protocolVersions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "capabilities": {
            "type": "object"
          },
          "_meta": {
            "type": "object",
            "properties": {
              "io.modelcontextprotocol/serverInfo": {
                "$ref": "#/components/schemas/McpServerInfo"
              }
            },
            "required": [
              "io.modelcontextprotocol/serverInfo"
            ]
          },
          "serverInfo": {
            "$ref": "#/components/schemas/McpServerInfo"
          },
          "instructions": {
            "type": "string"
          },
          "ttlMs": {
            "type": "integer"
          },
          "cacheScope": {
            "type": "string",
            "const": "public"
          }
        },
        "additionalProperties": false,
        "required": [
          "resultType",
          "supportedVersions",
          "capabilities",
          "_meta"
        ]
      },
      "McpToolsListResult": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/McpTool"
            },
            "minItems": 12,
            "maxItems": 12
          }
        },
        "additionalProperties": false,
        "description": "The exact twelve advertised tool names are inventoried under x-mcp-tools. Advertised schemas are less complete than runtime validation.",
        "required": [
          "tools"
        ]
      }
    },
    "responses": {
      "400": {
        "description": "Invalid application input or OAuth request. May also be an Axum path/body/form syntax rejection (plain text).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid release date range"
            }
          },
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "401": {
        "description": "Sign in required or invalid credentials; at /mcp also an invalid, expired or revoked bearer token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Sign in required"
            }
          }
        }
      },
      "403": {
        "description": "Host not allowed, Origin required or cross-origin request rejected. Host must match a configured origin authority. Account data routes do not permit cross-origin requests.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Origin required"
            }
          }
        }
      },
      "404": {
        "description": "Requested game, owned list or owned grant family not found. Other accounts are not disclosed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "List not found"
            }
          }
        }
      },
      "409": {
        "description": "Catalog changed during refresh, or a saved-filter revision is stale or its name conflicts.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Catalog changed during refresh; retry"
            }
          }
        }
      },
      "413": {
        "description": "Axum body extractor limit exceeded (default 2 MiB). Plain text, not the application JSON envelope.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "415": {
        "description": "Missing or unsupported JSON/form Content-Type. Plain text extractor response.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "422": {
        "description": "JSON/form is syntactically valid but cannot deserialize to the Rust request shape, including unknown Filter keys, invalid enum/type/range or missing fields. Plain text extractor response.",
        "content": {
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "429": {
        "description": "Login limiter exhausted: at most 10 attempts per normalized username and 120 globally in 60 seconds; no Retry-After. Counters are in memory per process.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Try again later"
            }
          }
        }
      },
      "500": {
        "description": "Internal storage/session/auth operation unavailable. Error text is sanitized by handlers; some OAuth helpers map storage errors to 400.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Database operation failed"
            }
          }
        }
      },
      "503": {
        "description": "Provider operation unavailable, or MCP/OAuth disabled. IGDB details not found and provider-specific validation also map here.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "IGDB is temporarily unavailable"
            }
          }
        }
      }
    }
  },
  "x-source-commit": "9d5aa8c699353b523832fa2880b884fdd7e7b2d2",
  "x-outbound-integrations": [
    {
      "name": "Google OpenID Connect",
      "direction": "outbound-only",
      "baseUrl": "https://accounts.google.com",
      "description": "Discovery and signing-key retrieval plus authorization-code exchange at Google-advertised HTTPS endpoints. Requests only openid, email and profile. Google access and refresh tokens are not retained."
    },
    {
      "name": "Twitch app authentication",
      "direction": "outbound-only",
      "baseUrl": "https://id.twitch.tv",
      "method": "POST",
      "path": "/oauth2/token",
      "requestMediaType": "application/x-www-form-urlencoded",
      "description": "Server-side client_credentials exchange. Fields: client_id, client_secret, grant_type. These credentials are never accepted by or returned from the browser API. Not the app-owned /oauth/token endpoint."
    },
    {
      "name": "IGDB catalog",
      "direction": "outbound-only",
      "baseUrl": "https://api.igdb.com/v4",
      "method": "POST",
      "paths": [
        "/games",
        "/games/count",
        "/platforms",
        "/genres",
        "/keywords",
        "/themes",
        "/companies",
        "/involved_companies"
      ],
      "description": "Server constructs provider query text and supplies Client-ID and bearer authentication. Exact-name lookups feed search; details uses /games. Successful public responses cache for 300 seconds (empty results for 30 seconds) in a 32-entry memory cache and bounded SQLite cache (128 entries, 32 MiB); refresh bypasses cached reads. Cache keys hash the provider query and version. Requests serialized per process, game/query starts spaced 260ms apart, 12-second HTTP timeout, at most three attempts for 429/5xx, 2,000,000-byte catalog response cap. Public API maps provider failures to 503."
    }
  ],
  "x-route-coverage": {
    "explicitOperations": 53,
    "implicitHead": "Axum GET routes accept HEAD and strip response bodies; /oauth/authorize HEAD may still create pending consent. These are derived GET behavior, not separately registered handlers.",
    "fallback": "ServeDir for ASSETS_PATH (default web/dist). A missing GET path under /api, /oauth, /mcp or /.well-known returns a JSON 404 Error; any other missing GET path returns index.html with 200 for the client-side TanStack routes. Static assets/UI are not JSON API operations. Other methods on missing paths, and unmatched methods on registered routes, produce framework 405."
  }
}
