Compliance Rules endpoints
Write and try the rules scripts are checked against when their approval is requested and signed. Paths are relative to the address of your Simcha DB Studio server.
Through the MCP server these endpoints are the Compliance Rules tool group, off until an admin turns it on.
While this group is on, the MCP server also offers the lookups its tools need: environments_list (List environments, from Environments and Groupings).
| Method | Path | What it does |
|---|---|---|
| GET | /api/db-devops/compliance-rules | List compliance rules |
| GET | /api/db-devops/compliance-rules/engines | List the engines a rule can target |
| POST | /api/db-devops/compliance-rules/test | Try a compliance rule on SQL |
| POST | /api/db-devops/compliance-rules/draft | Write a compliance rule from plain words |
| GET | /api/db-devops/compliance-rules/:id | Get a compliance rule |
| POST | /api/db-devops/compliance-rules | Create a compliance rule |
| PUT | /api/db-devops/compliance-rules/:id | Replace a compliance rule |
| DELETE | /api/db-devops/compliance-rules/:id | Delete a compliance rule |
GET /api/db-devops/compliance-rules
Lists every compliance rule by name, active or not, with its kind, severity, pattern and the engines and environments it applies to.
Reads only · Role: Any signed-in user · MCP tool: compliance_list
No inputs.
GET /api/db-devops/compliance-rules/engines
Returns the database engine names a compliance rule can be limited to.
Reads only · Role: Any signed-in user · MCP tool: compliance_engines
No inputs.
POST /api/db-devops/compliance-rules/test
Runs a rule's pattern on the SQL given, without saving anything, and returns whether it passes, why and the matching text. An llm rule is not judged here, and a hybrid rule that fails its pattern reports that the AI model would be asked to confirm.
Reads only · Role: Release manager or admin · MCP tool: compliance_test
| Input | Type | Description |
|---|---|---|
rule (body) | object, required | The rule to try |
rule.kind (body) | one of regex, llm, hybrid, required | How the rule is judged: regex (a pattern), llm (the AI model reads the description) or hybrid (the pattern first, and the AI model confirms a failure) |
rule.pattern (body) | string, optional | A JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules |
rule.patternFlags (body) | string, optional | Regular expression flags from i, m, s and u, each at most once. Defaults to i |
rule.patternNegate (body) | boolean, optional | When true the pattern must be present; otherwise the pattern is forbidden |
script (body) | string, required | The SQL to try the rule on, up to 200,000 characters |
POST /api/db-devops/compliance-rules/draft
Asks the configured AI model to turn a rule described in plain words into a compliance rule, and saves nothing. The answer holds rule (every field compliance_create takes), check (common for one of the common checks, words, pattern or model), examples (a script that fails the rule and one that passes it) and any warnings. A rule checked by text is tried on both examples first; when it does not behave as they say, the answer is 502 RULE_DRAFT_UNUSABLE. 409 AI_NOT_CONFIGURED when no AI provider is set, 403 AGENTS_DISABLED when an administrator turned AI agents off.
Changes data · Role: Release manager or admin · MCP tool: compliance_draft
| Input | Type | Description |
|---|---|---|
request (body) | string, required | The rule in plain words, up to 2,000 characters |
GET /api/db-devops/compliance-rules/:id
Returns one compliance rule.
Reads only · Role: Any signed-in user · MCP tool: compliance_get
| Input | Type | Description |
|---|---|---|
id (path) | string (uuid), required | The compliance rule ID |
POST /api/db-devops/compliance-rules
Creates a compliance rule. Refused when the name is taken, the pattern does not compile, or an engine or environment named does not exist.
Changes data · Role: Release manager or admin · MCP tool: compliance_create
| Input | Type | Description |
|---|---|---|
name (body) | string, required | The rule name, up to 128 characters, unique |
description (body) | string, required | What the rule requires, up to 2,000 characters |
severity (body) | one of info, warning, error, optional | How serious a failure is. A failing error rule refuses approval requests, signatures and script approvals. Defaults to warning |
isActive (body) | boolean, optional | Whether the rule is checked. Defaults to true |
kind (body) | one of regex, llm, hybrid, optional | How the rule is judged: regex (a pattern), llm (the AI model reads the description) or hybrid (the pattern first, and the AI model confirms a failure). Defaults to llm |
pattern (body) | string, optional | A JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules |
patternFlags (body) | string, optional | Regular expression flags from i, m, s and u, each at most once. Defaults to i |
patternNegate (body) | boolean, optional | When true the pattern must be present; otherwise the pattern is forbidden |
category (body) | string, optional | A category, up to 64 characters |
appliesToDialects (body) | list of string, optional | The database engines the rule applies to. Empty or left out means every engine |
appliesToEnvironments (body) | list of string, optional | The environments the rule applies to. Empty or left out means every environment |
remediation (body) | string, optional | How to fix a script that fails the rule, up to 2,000 characters |
PUT /api/db-devops/compliance-rules/:id
Replaces every field of a compliance rule: fields left out return to their defaults, so a rule saved without isActive becomes active. Refused for the same reasons as compliance_create.
Changes data · Role: Release manager or admin · MCP tool: compliance_update
| Input | Type | Description |
|---|---|---|
id (path) | string (uuid), required | The compliance rule ID |
name (body) | string, required | The rule name, up to 128 characters, unique |
description (body) | string, required | What the rule requires, up to 2,000 characters |
severity (body) | one of info, warning, error, optional | How serious a failure is. A failing error rule refuses approval requests, signatures and script approvals. Defaults to warning |
isActive (body) | boolean, optional | Whether the rule is checked. Defaults to true |
kind (body) | one of regex, llm, hybrid, optional | How the rule is judged: regex (a pattern), llm (the AI model reads the description) or hybrid (the pattern first, and the AI model confirms a failure). Defaults to llm |
pattern (body) | string, optional | A JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules |
patternFlags (body) | string, optional | Regular expression flags from i, m, s and u, each at most once. Defaults to i |
patternNegate (body) | boolean, optional | When true the pattern must be present; otherwise the pattern is forbidden |
category (body) | string, optional | A category, up to 64 characters |
appliesToDialects (body) | list of string, optional | The database engines the rule applies to. Empty or left out means every engine |
appliesToEnvironments (body) | list of string, optional | The environments the rule applies to. Empty or left out means every environment |
remediation (body) | string, optional | How to fix a script that fails the rule, up to 2,000 characters |
DELETE /api/db-devops/compliance-rules/:id
Deletes a compliance rule, so scripts are no longer checked against it.
Changes data and can remove or overwrite it · Role: Release manager or admin · MCP tool: compliance_delete
| Input | Type | Description |
|---|---|---|
id (path) | string (uuid), required | The compliance rule ID |