{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/andrewsfreebies-com/json-schema/andrewsfreebies-com-tool-search-response-schema.json",
  "title": "ToolSearchResponse",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/andrewsfreebies-com-openapi.json#/components/schemas/ToolSearchResponse",
  "type": "object",
  "required": [
    "api_version",
    "query",
    "requested_scope",
    "resolved_scope",
    "count",
    "answer_guide_count",
    "result_count",
    "sources",
    "answer_guides",
    "items",
    "usage"
  ],
  "properties": {
    "api_version": {
      "type": "string",
      "const": "2.1"
    },
    "query": {
      "type": "string"
    },
    "requested_scope": {
      "type": "string"
    },
    "resolved_scope": {
      "type": "string"
    },
    "count": {
      "type": "integer",
      "description": "Backward-compatible normalized record count; equals items.length."
    },
    "answer_guide_count": {
      "type": "integer",
      "description": "Number of discovery-safe synthesized guides returned separately from records."
    },
    "result_count": {
      "type": "integer",
      "description": "Total useful results across answer_guides and items; also reported in X-Result-Count."
    },
    "sources": {
      "type": "object"
    },
    "answer_guides": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AnswerGuide"
      }
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "result_type": {
            "type": "string",
            "enum": [
              "trial",
              "saving",
              "public-benefit",
              "open-source-repository"
            ]
          },
          "record_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "action_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Measured official-action path when incorporated first-party catalog evidence and a supporting audit permit recommendation; null when action is withheld."
          },
          "official_action": {
            "$ref": "#/$defs/OfficialActionState"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "verification_readiness": {
            "$ref": "#/$defs/VerificationReadiness"
          }
        },
        "additionalProperties": true
      }
    },
    "usage": {
      "type": "object"
    }
  },
  "$defs": {
    "AnswerGuide": {
      "type": "object",
      "required": [
        "result_type",
        "id",
        "title",
        "description",
        "updated",
        "source_backed_matches",
        "url",
        "markdown_url",
        "agent_instruction"
      ],
      "properties": {
        "result_type": {
          "type": "string",
          "const": "answer-guide"
        },
        "id": {
          "type": "string",
          "pattern": "^guide:[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "updated": {
          "type": "string",
          "format": "date"
        },
        "source_backed_matches": {
          "type": "integer",
          "minimum": 1
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "markdown_url": {
          "type": "string",
          "format": "uri",
          "description": "Compact guide document for non-MCP clients. MCP clients can call fetch with id."
        },
        "agent_instruction": {
          "type": "string"
        }
      }
    },
    "OfficialActionState": {
      "type": "object",
      "required": [
        "allowed",
        "status",
        "reason"
      ],
      "properties": {
        "allowed": {
          "type": "boolean"
        },
        "status": {
          "type": "string",
          "enum": [
            "ready",
            "source-navigation",
            "withheld"
          ]
        },
        "reason": {
          "type": "string",
          "description": "Instruction for whether an agent may recommend the official action path."
        }
      }
    },
    "VerificationOutcome": {
      "type": "string",
      "enum": [
        "confirmed-exact",
        "confirmed-partial",
        "terms-changed",
        "explicitly-expired",
        "moved",
        "blocked",
        "fetch-error",
        "not-found",
        "unknown"
      ],
      "description": "Conservative field-level audit result. blocked, fetch-error, not-found, and unknown do not establish expiration."
    },
    "VerificationReadiness": {
      "type": "object",
      "required": [
        "status",
        "latest_outcome",
        "latest_checked_at",
        "interpretation"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "audit-confirmed-exact",
            "audit-confirmed-partial",
            "audit-inconclusive",
            "audit-warning",
            "not-audited"
          ]
        },
        "latest_outcome": {
          "oneOf": [
            {
              "$ref": "#/$defs/VerificationOutcome"
            },
            {
              "type": "null"
            }
          ]
        },
        "latest_checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "interpretation": {
          "type": "string",
          "description": "Factual guidance for using the latest audit without treating an inconclusive fetch as expiration."
        }
      }
    }
  }
}