Get OPA policy by ID
opa_get_policyRetrieve a policy's Rego source from OPA by ID, with optional AST inclusion.
Instructions
Fetch a single policy by ID from the running OPA server. Returns the Rego source; the parsed AST is omitted unless asked for, since it is roughly forty times the size of the source it came from. Use rego_parse_ast on the source when an AST is what's wanted.
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": {
"id": "<id>"
},
"name": "opa_get_policy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Policy ID, e.g. "rbac" or "policies/auth/main". | |
| includeAst | No | Include OPA's parsed AST alongside the source. Off by default. |