{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "gno://schemas/mcp-capture-result@1.0",
  "title": "GNO MCP Capture Result",
  "description": "Result payload for gno_capture",
  "type": "object",
  "required": [
    "docid",
    "uri",
    "absPath",
    "collection",
    "relPath",
    "created",
    "openedExisting",
    "createdWithSuffix",
    "overwritten",
    "contentHash",
    "source",
    "tags",
    "sync",
    "embed",
    "collisionPolicyResult",
    "serverInstanceId"
  ],
  "properties": {
    "docid": {
      "type": "string",
      "description": "Document ID"
    },
    "uri": {
      "type": "string",
      "description": "Document URI",
      "pattern": "^gno://[^/]+/.+"
    },
    "absPath": {
      "type": "string",
      "description": "Absolute path to the created file"
    },
    "collection": {
      "type": "string",
      "description": "Normalized collection name"
    },
    "relPath": {
      "type": "string",
      "description": "Relative path within collection"
    },
    "created": {
      "type": "boolean",
      "description": "True if file was created"
    },
    "openedExisting": {
      "type": "boolean",
      "description": "True if an existing file was opened"
    },
    "createdWithSuffix": {
      "type": "boolean",
      "description": "True if a suffixed path was created"
    },
    "overwritten": {
      "type": "boolean",
      "description": "True if existing file was overwritten"
    },
    "contentHash": {
      "type": "string",
      "description": "SHA-256 hash of normalized capture body content",
      "pattern": "^[a-f0-9]{64}$"
    },
    "source": {
      "type": "object",
      "required": ["kind", "capturedAt"],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "direct",
            "web",
            "email",
            "meeting",
            "chat",
            "file",
            "api",
            "unknown"
          ]
        },
        "title": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "uri": { "type": "string" },
        "docid": { "type": "string" },
        "mime": { "type": "string" },
        "ext": { "type": "string" },
        "author": { "type": "string" },
        "canonicalUrl": { "type": "string", "format": "uri" },
        "site": { "type": "string" },
        "publishedAt": {
          "oneOf": [
            { "type": "string", "format": "date" },
            { "type": "string", "format": "date-time" }
          ]
        },
        "observedAt": { "type": "string", "format": "date-time" },
        "capturedAt": { "type": "string", "format": "date-time" },
        "externalId": { "type": "string" },
        "browserClip": {
          "$ref": "gno://schemas/browser-clip@1.0#/definitions/provenance"
        }
      }
    },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    },
    "sync": {
      "$ref": "#/definitions/indexStatus"
    },
    "embed": {
      "$ref": "#/definitions/indexStatus"
    },
    "collisionPolicyResult": {
      "type": "string",
      "enum": [
        "created",
        "opened_existing",
        "created_with_suffix",
        "overwritten",
        "conflict"
      ]
    },
    "serverInstanceId": {
      "type": "string",
      "description": "Server instance UUID",
      "format": "uuid"
    }
  },
  "definitions": {
    "indexStatus": {
      "type": "object",
      "required": ["status"],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "not_requested",
            "pending",
            "running",
            "completed",
            "skipped",
            "failed",
            "unknown"
          ]
        },
        "jobId": {
          "type": ["string", "null"]
        },
        "reason": {
          "type": "string"
        },
        "error": {
          "type": "string"
        }
      }
    }
  }
}
