{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://caplets.dev/caplet-frontmatter.schema.json",
  "title": "Caplet file frontmatter",
  "description": "YAML frontmatter schema for a Markdown Caplet file.",
  "type": "object",
  "properties": {
    "$schema": {
      "description": "Optional JSON Schema URL for editor validation.",
      "type": "string",
      "format": "uri"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "description": "Human-readable Caplet display name."
    },
    "description": {
      "type": "string",
      "description": "Compact capability description shown before the full Caplet card is disclosed."
    },
    "tags": {
      "description": "Optional tags for grouping or searching Caplets.",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80
      }
    },
    "exposure": {
      "type": "string",
      "enum": [
        "direct",
        "progressive",
        "code_mode",
        "direct_and_code_mode",
        "progressive_and_code_mode"
      ],
      "description": "How this Caplet is exposed to agents."
    },
    "useWhen": {
      "description": "When agents should prefer this Caplet or configured action.",
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "avoidWhen": {
      "description": "When agents should avoid this Caplet or configured action.",
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "setup": {
      "type": "object",
      "properties": {
        "commands": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "description": "Human-readable setup or verification step label."
              },
              "command": {
                "type": "string",
                "minLength": 1,
                "description": "Executable command to spawn without a shell."
              },
              "args": {
                "description": "Arguments passed to the command.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "env": {
                "description": "Additional environment variables.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "cwd": {
                "description": "Working directory for this command.",
                "type": "string",
                "minLength": 1
              },
              "timeoutMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "maxOutputBytes": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": ["label", "command"],
            "additionalProperties": false
          }
        },
        "verify": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "description": "Human-readable setup or verification step label."
              },
              "command": {
                "type": "string",
                "minLength": 1,
                "description": "Executable command to spawn without a shell."
              },
              "args": {
                "description": "Arguments passed to the command.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "env": {
                "description": "Additional environment variables.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "cwd": {
                "description": "Working directory for this command.",
                "type": "string",
                "minLength": 1
              },
              "timeoutMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "maxOutputBytes": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": ["label", "command"],
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false,
      "description": "Optional explicit setup and verification metadata for this Caplet."
    },
    "projectBinding": {
      "type": "object",
      "properties": {
        "required": {
          "type": "boolean",
          "const": true
        }
      },
      "required": ["required"],
      "additionalProperties": false,
      "description": "Project Binding requirements for Caplets that need an attached project."
    },
    "runtime": {
      "type": "object",
      "properties": {
        "features": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["docker", "browser"]
          }
        },
        "resources": {
          "type": "object",
          "properties": {
            "class": {
              "type": "string",
              "enum": ["standard", "large", "heavy"]
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "description": "Runtime feature and resource requirements for hosted execution."
    },
    "mcpServer": {
      "type": "object",
      "properties": {
        "transport": {
          "description": "Downstream MCP transport. Defaults to stdio when command is present.",
          "type": "string",
          "enum": ["stdio", "http", "sse"]
        },
        "command": {
          "description": "Executable command for stdio servers.",
          "type": "string",
          "minLength": 1
        },
        "args": {
          "description": "Arguments passed to the stdio command.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "env": {
          "description": "Environment variables for stdio servers. Supports ${VAR} and $env:VAR.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        },
        "cwd": {
          "description": "Working directory for stdio servers.",
          "type": "string",
          "minLength": 1
        },
        "url": {
          "description": "Remote MCP server URL for http or sse transport.",
          "type": "string",
          "minLength": 1
        },
        "auth": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "bearer"
                },
                "token": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type", "token"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "headers"
                },
                "headers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": ["type", "headers"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oauth2"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oidc"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            }
          ],
          "description": "Authentication settings for a remote MCP server."
        },
        "startupTimeoutMs": {
          "description": "Timeout in milliseconds for starting or checking a downstream server.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "callTimeoutMs": {
          "description": "Timeout in milliseconds for downstream tool calls.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "toolCacheTtlMs": {
          "description": "Milliseconds downstream tool metadata stays fresh. Set 0 to refresh every time.",
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery and do not start its MCP server.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "additionalProperties": false,
      "description": "MCP server backend configuration for this Caplet."
    },
    "openapiEndpoint": {
      "type": "object",
      "properties": {
        "specPath": {
          "description": "Local OpenAPI specification path.",
          "type": "string",
          "minLength": 1
        },
        "specUrl": {
          "description": "Remote OpenAPI specification URL.",
          "type": "string",
          "minLength": 1
        },
        "baseUrl": {
          "description": "Override base URL for OpenAPI requests.",
          "type": "string",
          "minLength": 1
        },
        "auth": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "bearer"
                },
                "token": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type", "token"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "headers"
                },
                "headers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": ["type", "headers"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oauth2"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oidc"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            }
          ],
          "description": "Explicit OpenAPI request auth config. Use {\"type\":\"none\"} for public APIs."
        },
        "requestTimeoutMs": {
          "description": "Timeout in milliseconds for OpenAPI HTTP requests.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "operationCacheTtlMs": {
          "description": "Milliseconds OpenAPI operation metadata stays fresh. Set 0 to refresh every time.",
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "required": ["auth"],
      "additionalProperties": false,
      "description": "OpenAPI endpoint backend configuration for this Caplet."
    },
    "graphqlEndpoint": {
      "type": "object",
      "properties": {
        "endpointUrl": {
          "type": "string",
          "minLength": 1,
          "description": "GraphQL HTTP endpoint URL."
        },
        "schemaPath": {
          "description": "Local GraphQL SDL or introspection path.",
          "type": "string",
          "minLength": 1
        },
        "schemaUrl": {
          "description": "Remote GraphQL SDL or introspection URL.",
          "type": "string",
          "minLength": 1
        },
        "introspection": {
          "description": "Load schema through endpoint introspection.",
          "type": "boolean",
          "const": true
        },
        "operations": {
          "description": "Configured GraphQL operations keyed by stable tool name.",
          "type": "object",
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,64}$"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "document": {
                "description": "Inline GraphQL operation document.",
                "type": "string",
                "minLength": 1
              },
              "documentPath": {
                "description": "Path to a GraphQL operation document.",
                "type": "string",
                "minLength": 1
              },
              "operationName": {
                "description": "Operation name to execute.",
                "type": "string",
                "minLength": 1
              },
              "description": {
                "description": "Operation capability description.",
                "type": "string",
                "minLength": 1
              },
              "useWhen": {
                "description": "When agents should prefer this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "avoidWhen": {
                "description": "When agents should avoid this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            },
            "additionalProperties": false
          }
        },
        "auth": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "bearer"
                },
                "token": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type", "token"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "headers"
                },
                "headers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": ["type", "headers"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oauth2"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oidc"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            }
          ],
          "description": "Explicit GraphQL request auth config. Use {\"type\":\"none\"} for public APIs."
        },
        "requestTimeoutMs": {
          "description": "Timeout in milliseconds for GraphQL HTTP requests.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "operationCacheTtlMs": {
          "description": "Milliseconds GraphQL operation metadata stays fresh. Set 0 to refresh every time.",
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "selectionDepth": {
          "description": "Maximum depth for auto-generated GraphQL selection sets.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 5
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "required": ["endpointUrl", "auth"],
      "additionalProperties": false,
      "description": "GraphQL endpoint backend configuration for this Caplet."
    },
    "httpApi": {
      "type": "object",
      "properties": {
        "baseUrl": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?![a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/[^/?#]*@)[^?#]*$",
          "description": "Base URL for HTTP action requests.",
          "format": "uri"
        },
        "auth": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "bearer"
                },
                "token": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type", "token"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "headers"
                },
                "headers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": ["type", "headers"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oauth2"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "oidc"
                },
                "authorizationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "tokenUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "issuer": {
                  "type": "string",
                  "minLength": 1
                },
                "resourceMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "authorizationServerMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "openidConfigurationUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientMetadataUrl": {
                  "type": "string",
                  "minLength": 1
                },
                "clientId": {
                  "type": "string",
                  "minLength": 1
                },
                "clientSecret": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "redirectUri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": ["type"],
              "additionalProperties": false
            }
          ],
          "description": "Explicit HTTP API request auth config. Use {\"type\":\"none\"} for public APIs."
        },
        "actions": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,64}$"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"],
                "description": "HTTP method used for this action."
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "pattern": "^\\/",
                "description": "URL path appended to the HTTP API baseUrl."
              },
              "description": {
                "description": "Action capability description.",
                "type": "string",
                "minLength": 1
              },
              "useWhen": {
                "description": "When agents should prefer this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "avoidWhen": {
                "description": "When agents should avoid this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "inputSchema": {
                "description": "JSON Schema for call_tool arguments.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "query": {
                "description": "Query parameter mapping.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                }
              },
              "headers": {
                "description": "Request header mapping.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                }
              },
              "jsonBody": {
                "description": "JSON request body mapping."
              }
            },
            "required": ["method", "path"],
            "additionalProperties": false
          },
          "description": "Configured HTTP actions keyed by stable tool name.",
          "minProperties": 1
        },
        "requestTimeoutMs": {
          "description": "Timeout in milliseconds for HTTP action requests.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "maxResponseBytes": {
          "description": "Maximum HTTP action response body bytes to read.",
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "required": ["baseUrl", "auth", "actions"],
      "additionalProperties": false,
      "description": "HTTP API backend configuration for this Caplet."
    },
    "cliTools": {
      "type": "object",
      "properties": {
        "actions": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,64}$"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "description": {
                "description": "Action capability description.",
                "type": "string",
                "minLength": 1
              },
              "useWhen": {
                "description": "When agents should prefer this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "avoidWhen": {
                "description": "When agents should avoid this Caplet or configured action.",
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "inputSchema": {
                "description": "JSON Schema for call_tool arguments.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "outputSchema": {
                "description": "JSON Schema for structuredContent returned by this action.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "command": {
                "type": "string",
                "minLength": 1,
                "description": "Executable command to spawn without a shell."
              },
              "args": {
                "description": "Arguments passed to the command.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "env": {
                "description": "Additional environment variables.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "cwd": {
                "description": "Working directory for this action.",
                "type": "string",
                "minLength": 1
              },
              "timeoutMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "maxOutputBytes": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "output": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": ["text", "json"]
                  }
                },
                "additionalProperties": false
              },
              "annotations": {
                "type": "object",
                "properties": {
                  "readOnlyHint": {
                    "type": "boolean"
                  },
                  "destructiveHint": {
                    "type": "boolean"
                  },
                  "idempotentHint": {
                    "type": "boolean"
                  },
                  "openWorldHint": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["command"],
            "additionalProperties": false
          },
          "description": "Configured CLI actions keyed by stable tool name.",
          "minProperties": 1
        },
        "cwd": {
          "description": "Default working directory for CLI actions.",
          "type": "string",
          "minLength": 1
        },
        "env": {
          "description": "Default environment variables.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        },
        "timeoutMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "maxOutputBytes": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "required": ["actions"],
      "additionalProperties": false,
      "description": "CLI tools backend configuration for this Caplet."
    },
    "capletSet": {
      "type": "object",
      "properties": {
        "configPath": {
          "description": "Child Caplets config.json path.",
          "type": "string",
          "minLength": 1
        },
        "capletsRoot": {
          "description": "Child Markdown Caplets root directory.",
          "type": "string",
          "minLength": 1
        },
        "defaultSearchLimit": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "maxSearchLimit": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 50
        },
        "toolCacheTtlMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "disabled": {
          "description": "When true, omit this Caplet from discovery.",
          "type": "boolean"
        },
        "projectBinding": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean",
              "const": true
            }
          },
          "required": ["required"],
          "additionalProperties": false,
          "description": "Project Binding requirements for Caplets that need an attached project."
        },
        "runtime": {
          "type": "object",
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["docker", "browser"]
              }
            },
            "resources": {
              "type": "object",
              "properties": {
                "class": {
                  "type": "string",
                  "enum": ["standard", "large", "heavy"]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Runtime feature and resource requirements for hosted execution."
        }
      },
      "additionalProperties": false,
      "description": "Nested Caplet collection backend configuration for this Caplet."
    }
  },
  "required": ["name", "description"],
  "additionalProperties": false
}
