# Validation YAML Schema
# Extends the Tool schema with validation-specific fields.
# See docs/specification.md for full details.

type: object
required:
  - name
  - description
properties:
  name:
    type: string
    pattern: "^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$"
    description: "Namespaced validation name (namespace/short_name)"
  description:
    type: string
    minLength: 1
    description: "Short description of what the validation checks"
  source:
    type: string
    enum: [mcp, agent_skill, builtin, custom, wrapped]
    description: "Source of the validation implementation (inferred as 'wrapped' when wraps is set)"
  mode:
    type: string
    enum: [required, informational]
    default: required
    description: "Whether failure blocks execution"
  wraps:
    type: string
    description: "Name of existing tool this validation wraps"
  transform:
    type: string
    description: "Python function code to transform wrapped tool output (required when wraps is set)"
  argument_mapping:
    type: object
    description: "Argument mapping for the wrapped tool (only valid when wraps is set)"
  code:
    type: string
    description: "Inline Python code (required when source=custom, mutually exclusive with wraps)"
  mcp_server:
    type: string
    description: "MCP server name (required when source=mcp)"
  mcp_tool_name:
    type: string
    description: "Tool name on MCP server (required when source=mcp)"
  agent_skill_path:
    type: string
    description: "Path to Agent Skills Standard folder (required when source=agent_skill)"
  input_schema:
    type: object
    description: "JSON Schema for validation inputs"
  output_schema:
    type: object
    description: "JSON Schema for validation outputs"
  capability:
    type: object
    description: "Capability metadata (read_only, writes, checkpointable forced for validations)"
  resource_slots:
    type: array
    items:
      type: object
      required: [name, resource_type, access]
      properties:
        name:
          type: string
        resource_type:
          type: string
        access:
          type: string
          enum: [read_only, read_write]
        description:
          type: string
        binding:
          type: string
          enum: [contextual, static, parameter]
          default: contextual
        static_resource:
          type: string
        required:
          type: boolean
          default: true
  lifecycle:
    type: object
    properties:
      discover:
        type: string
      activate:
        type: string
      deactivate:
        type: string
  timeout:
    type: integer
    minimum: 1
    default: 300
    description: "Execution timeout in seconds"
