Skip to main content
Glama

Save rules

put_rules
Destructive

Create or replace a domain's rule set from YAML, with validation and a dry-run mode to test before saving, reporting errors and overlap warnings.

Instructions

Create or replace a domain's rule set from YAML (self-serve rule authoring).

The first save to a new domain claims it for your account (plan limits apply); the built-in demo domains are read-only. Rules are validated before saving — set dry_run=true to validate without persisting. The response reports ok/errors, the parsed rules, and any overlap warnings.

YAML format — a list of rules. Flat form (conditions are AND-ed): - name: "Approve" salience: 10 conditions: - type: loan field: credit_score op: ">=" value: 700 action: verdict: "APPROVED" reason: "Credit score meets threshold"

Tree form — when: holds nested all/any/not condition groups, and an action may assert derived facts that other rules consume (forward chaining; the rule graph derives from these automatically): - name: "Sepsis Screen" salience: 30 when: all: - {type: clinical, field: temperature_f, op: ">=", value: 101.5} - any: - {type: clinical, field: wbc_count, op: ">", value: 12.0} - {type: clinical, field: bands_pct, op: ">", value: 10} action: verdict: "URGENT_ALERT" assert: - {type: sepsis_flag, fields: {severity: high}} - name: "Escalate" salience: 40 when: all: - {type: sepsis_flag, field: severity, op: "==", value: high} - {type: clinical, field: age, op: ">=", value: 65} action: verdict: "ADMIT_ICU"

Use either conditions: or when: per rule, never both. not passes when the inner condition does not hold (including when the field is absent). Produce/consume cycles between rules are rejected at validation. An action may also carry retrieval_scope: { <key>: <value> } to narrow which documents retrieval searches (Pattern 01).

A rule may also carry citation: — the policy sentence it encodes. It is stored with the rule and shown beside it in decision audits, so a verdict can be defended with the source language, not just the rule name: - name: "Decline Late Returns" salience: 20 citation: "Returns are accepted within 30 days of delivery." when: all: - {type: retail, field: days_since_delivery, op: ">", value: 30} action: verdict: "DENIED"

IMPORTANT: when persisting drafts returned by import_policy_rules, copy each rule's citation through into this YAML. Dropping it silently loses the link from the decision back to the policy clause that justifies it.

Args: domain: Domain to author (an owned domain, or a new name to claim). rules_yaml: The full rule set as YAML text. dry_run: Validate only, without saving.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
dry_runNo
rules_yamlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Even with destructiveHint=true, the description adds substantial behavioral detail: domain claiming, plan limits, read-only demo domains, validation before saving, response contents, cycle rejection, and the behavior of 'not' on absent fields. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every section earns its place: summary, ownership caveats, YAML formats with examples, validation semantics, citation guidance, and an integration note for import_policy_rules. It is front-loaded and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's high complexity (nested all/any/not, forward chaining, citations, retrieval scopes), the description thoroughly covers behavior, input format, edge cases, and response contents. It is complete enough for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the Args section and extensive YAML examples thoroughly explain domain, rules_yaml, and dry_run. The description compensates fully, even covering nested condition structures, assertions, citations, and retrieval_scope.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Create or replace a domain's rule set from YAML (self-serve rule authoring).' This is a specific verb+resource statement that clearly distinguishes it from sibling tools like list_rules and decide. The 'replace' aspect also sets it apart from simple creation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear context: first save claims a domain, demo domains are read-only, and dry_run validates without persisting. It references import_policy_rules for persisting drafts, but does not explicitly contrast with other siblings or state when not to use the tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zaharajabeen13-create/ai-rete-rag-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server