{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/giljo-ai/json-schema/giljo-ai-authorize-request-schema.json",
  "title": "AuthorizeRequest",
  "description": "Request body for the OAuth authorize (consent) endpoint.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amh-openapi.json#/components/schemas/AuthorizeRequest",
  "properties": {
    "client_id": {
      "type": "string",
      "maxLength": 256,
      "title": "Client Id",
      "description": "OAuth client identifier"
    },
    "redirect_uri": {
      "type": "string",
      "maxLength": 2048,
      "title": "Redirect Uri",
      "description": "URI to redirect after authorization"
    },
    "code_challenge": {
      "type": "string",
      "maxLength": 128,
      "title": "Code Challenge",
      "description": "PKCE S256 code challenge"
    },
    "code_challenge_method": {
      "type": "string",
      "maxLength": 16,
      "title": "Code Challenge Method",
      "description": "PKCE challenge method (must be S256)",
      "default": "S256"
    },
    "scope": {
      "type": "string",
      "maxLength": 512,
      "title": "Scope",
      "description": "Requested OAuth scope. Must be a subset of ['mcp:agent', 'mcp:read', 'mcp:write']. The orchestration scope (`mcp:agent`) IS grantable here so an OAuth client reaches API-key parity (guarded by the localhost redirect allowlist + consent).",
      "default": "mcp:read mcp:write mcp:agent"
    },
    "state": {
      "type": "string",
      "maxLength": 4096,
      "title": "State",
      "description": "Opaque state value for CSRF protection",
      "default": ""
    },
    "response_type": {
      "type": "string",
      "maxLength": 32,
      "title": "Response Type",
      "description": "OAuth response type (must be code)",
      "default": "code"
    },
    "consent": {
      "type": "string",
      "enum": [
        "allow",
        "deny"
      ],
      "title": "Consent",
      "description": "The authenticated user's explicit authorization decision.",
      "default": "allow"
    },
    "resource": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048
        },
        {
          "type": "null"
        }
      ],
      "title": "Resource",
      "description": "RFC 8707 resource indicator. Identifies the target resource server (typically the canonical MCP URI). When supplied, it is persisted onto the auth-code record and re-asserted at /token."
    }
  },
  "type": "object",
  "required": [
    "client_id",
    "redirect_uri",
    "code_challenge"
  ]
}