Build OPA bundle
opa_bundle_buildBuilds a deployable .tar.gz policy bundle from Rego/data paths via opa build, with optional signing, optimization, custom revisions, and WASM output for OPA deployment.
Instructions
Build a deployable bundle from policy / data paths using opa build. Output is a .tar.gz archive with optional inline signing. Supports optimization, custom revision strings, and the WASM target. The paths go to opa relative to the folder that holds them all, so modules are named by their place under it, not by absolute path. OPA 1.23 and later root a bundle directory at the folder holding its .manifest, even a nested one, and leave out the files above it; what opa warns about comes back in warnings.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"paths": "<paths>",
"output": "<output>"
},
"name": "opa_bundle_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | Policy / data paths to include. Each must be in an allowed root. | |
| bundle | No | Load `paths` as bundle files or root directories (`--bundle`). Implied by `signingKey` and `verificationKey`; set it explicitly to rebuild an existing bundle without signing. | |
| ignore | No | File/directory name patterns to ignore during loading (`--ignore`), e.g. `[".*"]` to skip hidden files. These are name patterns, not filesystem paths. | |
| output | Yes | Output bundle path (typically `*.tar.gz`). Must be in an allowed root. | |
| target | No | Build target (default `rego`; `wasm` compiles to WebAssembly). | |
| optimize | No | Optimization level (0 = none, 2 = aggressive). | |
| revision | No | Bundle revision string written to the manifest. | |
| claimsFile | No | Path to a claims file for inline signing. | |
| signingAlg | No | Signing algorithm (e.g. RS256). | |
| signingKey | No | Path to a PEM private key for signing the built bundle (`--signing-key`). Implies `bundle: true`, which OPA requires for signing. | |
| entrypoints | No | Entrypoint refs (required when `target=wasm` or `optimize > 0`). | |
| pruneUnused | No | Exclude dependents of entrypoints that are not reachable from them (`--prune-unused`). Most useful alongside `entrypoints`. | |
| capabilities | No | Path to a capabilities JSON file. | |
| v0Compatible | No | Read the policy as Rego v0 (`--v0-compatible`), the syntax OPA used before 1.0: rules without `if`, partial sets as `deny[msg] { ... }`. Needed for a policy that has not been migrated, which OPA 1.x otherwise refuses to load. Where the tool also takes a query, the query is read as v0 too, with the future keywords imported so `in`, `every` and `some x in` still work in it. | |
| v1Compatible | No | Opt in to OPA v1.0-compatible behaviors (`--v1-compatible`). Affects the built bundle's runtime semantics. | |
| verificationKey | No | Path to a PEM public key (or HMAC secret file) used to re-verify an existing signed bundle during the build (`--verification-key`). Implies `bundle: true`, which OPA requires for verification. A delta bundle (one with a `patch.json`) cannot be signed, so it fails as `INVALID_BUNDLE` with `details.reason` delta_bundle and leaves no output. | |
| verificationKeyId | No | Key ID for verification (`--verification-key-id`, OPA default `default`). |