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).

MethodPathWhat it does
GET/api/db-devops/compliance-rulesList compliance rules
GET/api/db-devops/compliance-rules/enginesList the engines a rule can target
POST/api/db-devops/compliance-rules/testTry a compliance rule on SQL
POST/api/db-devops/compliance-rules/draftWrite a compliance rule from plain words
GET/api/db-devops/compliance-rules/:idGet a compliance rule
POST/api/db-devops/compliance-rulesCreate a compliance rule
PUT/api/db-devops/compliance-rules/:idReplace a compliance rule
DELETE/api/db-devops/compliance-rules/:idDelete 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

InputTypeDescription
rule (body)object, requiredThe rule to try
rule.kind (body)one of regex, llm, hybrid, requiredHow 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, optionalA JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules
rule.patternFlags (body)string, optionalRegular expression flags from i, m, s and u, each at most once. Defaults to i
rule.patternNegate (body)boolean, optionalWhen true the pattern must be present; otherwise the pattern is forbidden
script (body)string, requiredThe 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

InputTypeDescription
request (body)string, requiredThe 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

InputTypeDescription
id (path)string (uuid), requiredThe 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

InputTypeDescription
name (body)string, requiredThe rule name, up to 128 characters, unique
description (body)string, requiredWhat the rule requires, up to 2,000 characters
severity (body)one of info, warning, error, optionalHow serious a failure is. A failing error rule refuses approval requests, signatures and script approvals. Defaults to warning
isActive (body)boolean, optionalWhether the rule is checked. Defaults to true
kind (body)one of regex, llm, hybrid, optionalHow 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, optionalA JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules
patternFlags (body)string, optionalRegular expression flags from i, m, s and u, each at most once. Defaults to i
patternNegate (body)boolean, optionalWhen true the pattern must be present; otherwise the pattern is forbidden
category (body)string, optionalA category, up to 64 characters
appliesToDialects (body)list of string, optionalThe database engines the rule applies to. Empty or left out means every engine
appliesToEnvironments (body)list of string, optionalThe environments the rule applies to. Empty or left out means every environment
remediation (body)string, optionalHow 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

InputTypeDescription
id (path)string (uuid), requiredThe compliance rule ID
name (body)string, requiredThe rule name, up to 128 characters, unique
description (body)string, requiredWhat the rule requires, up to 2,000 characters
severity (body)one of info, warning, error, optionalHow serious a failure is. A failing error rule refuses approval requests, signatures and script approvals. Defaults to warning
isActive (body)boolean, optionalWhether the rule is checked. Defaults to true
kind (body)one of regex, llm, hybrid, optionalHow 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, optionalA JavaScript regular expression, up to 2,000 characters. Required for regex and hybrid rules
patternFlags (body)string, optionalRegular expression flags from i, m, s and u, each at most once. Defaults to i
patternNegate (body)boolean, optionalWhen true the pattern must be present; otherwise the pattern is forbidden
category (body)string, optionalA category, up to 64 characters
appliesToDialects (body)list of string, optionalThe database engines the rule applies to. Empty or left out means every engine
appliesToEnvironments (body)list of string, optionalThe environments the rule applies to. Empty or left out means every environment
remediation (body)string, optionalHow 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

InputTypeDescription
id (path)string (uuid), requiredThe compliance rule ID