{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nirvanahq-com/json-schema/nirvanahq-com-search-result-response-schema.json",
  "title": "SearchResultResponse",
  "description": "The canonical search result (SEARCH_QUERY_GRAMMAR.md §12.5). Rows are in display order; every page carries every group.\n",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nirvanahq-com-openapi.yaml#/components/schemas/SearchResultResponse",
  "type": "object",
  "required": [
    "ok",
    "grammar_version",
    "rows"
  ],
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "grammar_version": {
      "type": "integer"
    },
    "query": {
      "type": "string"
    },
    "canonical_query": {
      "type": [
        "string",
        "null"
      ],
      "description": "The query in canonical spelling (§4.1): accepted spellings such as is:project or no:due rewritten to type:project and -has:due, OR groups flattened, inline sort:/group: moved to the layout. Null when the query uses reserved syntax (unsupported_syntax hint).\n"
    },
    "view": {
      "type": [
        "string",
        "null"
      ]
    },
    "filters": {
      "type": "string",
      "description": "The structured filters (state, tags, …) as terms, echoed apart from the query they were ANDed with. Present only when some were passed."
    },
    "today": {
      "type": "string",
      "format": "date"
    },
    "timezone": {
      "type": "string"
    },
    "scope": {
      "$ref": "#/$defs/McpScope"
    },
    "layout": {
      "type": "object",
      "description": "The resolved layout (§12.9): group, sort, limit, done, starred."
    },
    "total": {
      "type": "integer"
    },
    "hidden_inactive": {
      "type": "integer"
    },
    "returned": {
      "type": "integer"
    },
    "has_more": {
      "type": "boolean"
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Null on the last page."
    },
    "hints": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SearchHint"
      }
    },
    "groups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "container": {
            "type": "object"
          }
        }
      }
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object"
      }
    }
  },
  "$defs": {
    "McpScope": {
      "type": "object",
      "properties": {
        "area": {
          "type": "string"
        },
        "areamode": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "inclusive",
            "exclusive",
            null
          ]
        }
      }
    },
    "SearchHint": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "hidden_inactive",
            "unknown_value",
            "unsupported_syntax",
            "layout_ignored",
            "version_newer",
            "truncated",
            "done_window"
          ]
        },
        "count": {
          "type": "integer"
        },
        "text": {
          "type": "string"
        }
      }
    }
  }
}