@xano/developer-mcp 2.3.0-beta.2 → 2.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -415,7 +415,8 @@ Retrieves XanoScript programming language documentation with context-aware suppo
415
415
  | `middleware` | Request/response interceptors for functions, queries, tasks, and tools |
416
416
  | `branch` | Branch-level settings: middleware, history retention, visual styling |
417
417
  | `workspace` | Workspace-level settings: environment variables, preferences, realtime |
418
- | `policies` | Workspace policy documents: syntax, the check catalogue, goals and authoring rules |
418
+ | `policies` | Workspace policy documents: syntax, the check catalogue, templates and authoring rules |
419
+ | `policy-templates` | The platform's policy templates, recipes for goals that take several, and what no check can see |
419
420
 
420
421
  **Examples:**
421
422
  ```
@@ -497,7 +498,7 @@ Get documentation for Xano's Meta API. Use this to understand how to programmati
497
498
  | `realtime` | Real-time channel operations |
498
499
  | `file` | File management |
499
500
  | `history` | Version history |
500
- | `policy` | Workspace policies: check catalogue and goals, parse, save, object lookup, evaluate, runs (whole, summary and findings pages), agent skill |
501
+ | `policy` | Workspace policies: check catalogue and templates, parse, save, object lookup, evaluate, runs (whole, summary and findings pages), agent skill |
501
502
  | `workflows` | Step-by-step workflow guides |
502
503
 
503
504
  **Examples:**
@@ -610,6 +611,7 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
610
611
  | `xanoscript://docs/branch` | Branch-level settings |
611
612
  | `xanoscript://docs/workspace` | Workspace-level settings |
612
613
  | `xanoscript://docs/policies` | Workspace policy documents |
614
+ | `xanoscript://docs/policy-templates` | Policy templates and recipes |
613
615
 
614
616
  ## npm Scripts
615
617
 
@@ -621,7 +623,7 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
621
623
  | `test` | `vitest run` | Run unit tests |
622
624
  | `test:watch` | `vitest` | Run tests in watch mode |
623
625
  | `test:coverage` | `vitest run --coverage` | Run tests with coverage report |
624
- | `gen:policy-docs` | `node scripts/gen-policy-check-docs.mjs` | Regenerate the check catalogue regions of `policies.md` from `scripts/policy-catalogue.json` |
626
+ | `gen:policy-docs` | `node scripts/gen-policy-check-docs.mjs` | Regenerate the check catalogue regions of `policies.md`, and `policy-templates.md`, from `scripts/policy-catalogue.json` |
625
627
 
626
628
  ## Project Structure
627
629
 
@@ -739,7 +741,7 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
739
741
  - **aliases**: Alternative names for topic lookup
740
742
  - **priority**: Ordering weight for file_path matching
741
743
  - **exclusive**: The topic alone documents the files its `applyTo` matches, so file_path mode returns only that topic
742
- - The check catalogue in `policies.md` is generated between its `BEGIN GENERATED` and `END GENERATED` markers. To refresh it, save the catalogue the platform serves (`xano policy catalogue -o json`, from an instance running the matching platform version) to `scripts/policy-catalogue.json`, then run `npm run gen:policy-docs`; a test fails when the two disagree
744
+ - The check catalogue in `policies.md` (the checks and their uses, the scope fields, the statement names and the fix hints) is generated between its `BEGIN GENERATED` and `END GENERATED` markers, and `policy-templates.md` (the templates, the recipes and what no check can see) is generated whole. To refresh them, save the catalogue the platform serves (`xano policy catalogue -o json`, from an instance running the matching platform version) to `scripts/policy-catalogue.json`, then run `npm run gen:policy-docs`; a test fails when the two disagree
743
745
 
744
746
  **Meta API Documentation** (`src/meta_api_docs/`):
745
747
  - TypeScript modules with structured documentation
@@ -18,13 +18,13 @@ export const policyDoc = {
18
18
  Use the authenticated Xano MCP tools for live tool calls, or these CLI commands for local workspace files. The standalone developer MCP serves this documentation; it does not itself authenticate to your workspace.`,
19
19
  ai_hints: `Discover exact check parameters with policy catalogue; each entry carries a human label beside its check id. Native policy parse is the validation authority. The developer MCP's language server checks policy syntax locally, and checks rules only as warnings against its bundled copy of the catalogue, which may be older than the instance. An unknown check id is refused by parse, publish and workspace push with payload.code policy_unknown_check, naming the nearest ids, and the CLI adds a pointer to xano policy catalogue. Do not invent a local policy parser. policy parse prints canonical source, which is sparse and orders params the catalogue's way, so do not read a shorter file as a lost setting.
20
20
 
21
- Reads, parsing and evaluation need the workspace:policy permission at read level; creating, updating and deleting need it at create, update or delete level. A refused request prints the platform's message and what to do about it, keyed on the refusal's code: the feature is off, the role lacks the permission (an instance admin grants it; a new token does not help), or the token was created without the scope (create one that has it). workspace push lets unchanged policy files through for any reader; a changed policy file from a caller whose permission does not allow the change refuses the whole push, so exclude them with -e "policies/*" or pull again.
21
+ Reads, parsing and evaluation need the workspace:policy permission at read level; creating, updating and deleting need it at create, update or delete level. policy coverage is the exception: it needs only the object kind's own read permission (workspace:api for an endpoint, workspace:function, workspace:database for a table, ...), never workspace:policy, and a refusal (policy_object_permission_required) names that permission, which the role or, for a Metadata API token, the token's scopes lack. A refused request prints the platform's message and what to do about it, keyed on the refusal's code: the feature is off, the role lacks the permission (an instance admin grants it; a new token does not help), or the token was created without the scope (create one that has it). workspace push lets unchanged policy files through for any reader; a changed policy file from a caller whose permission does not allow the change refuses the whole push, so exclude them with -e "policies/*" or pull again.
22
22
 
23
- Policy source uses active = true or active = false before enforcement. The retired lifecycle field is refused. policy list labels rows Active, Mandatory; Active, Advisory; or Inactive. Inactive policies are saved directly, skipped by branch checks, and reported with status inactive.
23
+ Policy source uses active = true or active = false before enforcement. The retired lifecycle field is refused. policy list labels rows Active, Blocking; Active, Advisory; or Inactive. Inactive policies are saved directly, skipped by branch checks, and reported with status inactive.
24
24
 
25
25
  A parse or validation error in summary output is located at line N, col M, with line 1 the first line, followed by the offending text; -o json keeps the platform payload untouched, whose line and col count from 1 too. Every policy command run with -o json reports its own failure as one object on stdout rather than as prose on stderr: {"error": {"message": "...", "exit": 1}}, and exits 1. Exit 2 is never an error object: it is reserved for blocking findings, which are ordinary results.
26
26
 
27
- policy evaluate and workspace push print the platform's policy_check verdict (see the Metadata API policy topic for the statuses). Their exit code follows the import and the blocking policies only: 1 when the import or the request fails, 2 whenever policy_check.blocking is true (an active mandatory policy has findings; an inactive policy never blocks), and 0 otherwise. A pass, a fail and not_applicable (no active policy on the branch) print a headline with the platform's message; disabled, forbidden, unavailable, error or no feedback at all print one warning line on stderr with the platform's status and message, and leave the exit code alone. For CI, key on policy_check.blocking in -o json rather than on status: advisory findings arrive as status fail with blocking false. A policy finding never rolls back imported code on a branch that is not live. A push to the live branch is gated before it commits: a 403 policy_gate refusal exits 2, says nothing was imported, lists the blocking findings and introduced/changed counts, and under -o json prints {imported: false, refused: <payload>}; --policy-override "<reason>" sends an audited override (workspace:policy update), and --no-transaction to live is refused (exit 1). A create past the plan's per-branch cap is refused with policy_plan_limit, naming the plan. Releases carry policies: release create, push and import print the release's stored policy check; tenant deploy_release --check prints the deploy gate's verdict and --override-reason overrides it; tenant_deploy_request set_status and bypass take --override-policy; a refused deploy exits 2. release deploy --set_live and branch set_live exit 2 when the set-live gate refuses (a refused release deploy keeps the new branch and names it), and function create and function edit exit 2 when the live-branch publish gate refuses the save (nothing is saved); each takes --policy-override "<reason>" (workspace:policy update; only with the user's own reason), a blank one is refused before any request, and any other failure exits 1. A workspace push (its --dry-run too), branch set_live, release deploy --set_live or policy delete (of an active mandatory policy) that weakens a mandatory policy without workspace:policy update is refused with policy_weakening_permission_required and exits 1, a permission refusal rather than a blocking finding: the CLI prints the platform's sentence and how to go on (leave the policy files out with -e "policies/*"; a deployed release's branch stays and is named), and --policy-override does not lift it. policy parse and policy publish print rule warnings on stderr.
27
+ policy evaluate and workspace push print the platform's policy_check verdict (see the Metadata API policy topic for the statuses). Their exit code follows the import and the blocking policies only: 1 when the import or the request fails, 2 whenever policy_check.blocking is true (an active blocking policy has findings; an inactive policy never blocks), and 0 otherwise. A pass, a fail and not_applicable (no active policy on the branch) print a headline with the platform's message; disabled, unavailable, error, any other status (an older instance's forbidden) or no feedback at all print one warning line on stderr with the platform's status and message, and leave the exit code alone. A workspace push by a credential without workspace:policy read gets a policy_check with access: "coverage" and scope: "pushed_objects": only its own findings on the objects the push carried that it may read (the workspace too, for a push carrying workspace.xs and a credential with workspace:settings read), each printed with its policy key and title, rule name, message and Fix: hint under Blocking or Advisory, then a count of the findings on objects the push did not list (On objects this push did not list: N new findings (B blocking), counted, not named.; N findings instead of N new findings when elsewhere.basis is all, no baseline being known, or missing, from an older platform) and the platform's note; it names no run (run_id 0), so the CLI prints no xano policy runs hint. blocking is what a policy reader's push of the same change says, so exit 2 follows it whoever pushes, even with nothing of the credential's own listed. For CI, key on policy_check.blocking in -o json rather than on status: advisory findings arrive as status fail with blocking false. A policy finding never rolls back imported code on a branch that is not live. A push to the live branch is gated before it commits: a 403 policy_gate refusal exits 2, prints the platform's sentence (it names the policies the blocking findings come from, to every caller) and says nothing was imported, lists the blocking findings for a credential with workspace:policy read (anyone else gets the counts and the keys), and under -o json prints {imported: false, refused: <payload>}; --policy-override "<reason>" sends an audited override (workspace:policy update), and --no-transaction to live is refused (exit 1). A create past the plan's per-branch cap is refused with policy_plan_limit, naming the plan. Releases carry policies: release create, push and import print the release's stored policy check; tenant deploy_release --check prints the deploy gate's verdict and --override-reason overrides it; tenant_deploy_request set_status and bypass take --override-policy; a refused deploy exits 2. release deploy --set_live and branch set_live exit 2 when the set-live gate refuses (a refused release deploy keeps the new branch and names it), and function create and function edit exit 2 when the live-branch publish gate refuses the save (nothing is saved); each takes --policy-override "<reason>" (workspace:policy update; only with the user's own reason), a blank one is refused before any request, and any other failure exits 1. Each policy change needs only its own workspace:policy level: update to edit a policy, delete to delete one (an active blocking policy included); branch set_live and release deploy --set_live need no policy permission. policy parse and policy publish print rule warnings on stderr.
28
28
 
29
29
  A rule with zero objects checked and no findings has status no_objects and message no objects checked. Older stored runs keep pass with checked: 0; readers accept both. The run and policy_check stay pass when nothing failed, and policy_check.message names the unchecked rules. Merge, publish and deploy gates read findings and are unaffected. The CLI summary renders both as no objects checked, never as an error; policy status keeps its no_objects_checked row status.
30
30
 
@@ -35,14 +35,14 @@ Publishing an identical definition writes nothing and prints No changes; JSON ou
35
35
  workspace pull writes policies to policies/<KEY>.xs when the credential can read them (without workspace:policy read the pull succeeds and omits them) and prints one hint after a pull that included them: Run \`xano skills pull\` to install the policies skill for your coding agent (see the skills topic). workspace push includes policies in the normal multidoc import and reports policy_check afterward; the workspace topic covers its -m/--message. sandbox push and ephemeral push (and their --dry-run) and release push carry policy files while the instance's Policies feature is on: a sandbox or ephemeral push lands them without evaluating them (no policy_check), and release push sends policies/*.xs with the rest and prints the release's stored policy check. A release built by release push carries those files only for a caller holding workspace:policy create and update; for anyone else it carries the workspace's live-branch policies instead, and the push prints the platform's policies_skipped message naming the files when they differ from the live ones. release import of an archive that carries policies needs the same workspace:policy create and update: without them the platform refuses it, nothing is stored, and the CLI prints the platform's message and the remedy for the role or the token. A push to a remote tenant, a push to a tenant created before policies (it has no policy table until its next platform update), or any push while the feature is off leaves them out, and the push prints the platform's policies_skipped message once, as a warning naming the files and why. While the instance's Policies feature is off, workspace pull carries no policies (and prints no skills hint) and workspace push leaves its policy files out, printing the platform's one line instead of a policy count. Existing workspace push deletion/sync behavior remains governed by its normal flags.`,
36
36
  related_topics: ["workspace", "profile", "branch", "skills"],
37
37
  commands: [
38
- { name: "policy catalogue", description: "List built-in checks, their schemas and analysis limitations from the instance. The full catalogue is long; --check narrows it to one check id in either output mode, and an unknown id names the closest matches.", usage: "xano policy catalogue [options]", flags: [...flags, { name: "check", type: "string", description: "Show only this check id" }], examples: ["xano policy catalogue -o json", "xano policy catalogue --check object.auth_required"] },
38
+ { name: "policy catalogue", description: "List built-in checks, their schemas and analysis limitations from the instance, each followed by its uses (a goal in a customer's words, the params that achieve it as one line of JSON, scope params included, and a note when it has one), then the templates a policy can start from, grouped under the catalogue's category labels in its order. The recipes follow: goals that span several templates, each with what to set up first, its templates in the order to create them, the rules no template covers (created together in a policy of your own) and what no rule in it can see. The catalogue ends with what no check can see, each topic with why. The full catalogue is long; --check narrows it to one check id and --recipe to one recipe id (the summary adds the topics that recipe cannot see), in either output mode, and an unknown id names the closest matches; the two flags cannot be combined. -o json without them is the whole catalogue as served.", usage: "xano policy catalogue [options]", flags: [...flags, { name: "check", type: "string", description: "Show only this check id; not with --recipe" }, { name: "recipe", type: "string", description: "Show only this recipe id and what it cannot see; not with --check" }], examples: ["xano policy catalogue -o json", "xano policy catalogue --check object.auth_required", "xano policy catalogue --recipe protect_card_data"] },
39
39
  { name: "policy list", description: "List policies on the selected branch, each with its active state, id and current version.", usage: "xano policy list [options]", flags, examples: ["xano policy list -b dev -o json"] },
40
40
  {
41
41
  name: "policy create",
42
- description: "Create an independent Active, Advisory policy from a platform goal (the goals in policy catalogue -o json). Copies the goal's sparse settings; every needs path must be filled with --param. Parsed natively before saving. A taken goal key gets a free numeric suffix (case-insensitive); a taken explicit --key is refused. Never updates an existing policy and stores no link to the goal. Rule warnings go to stderr; -o json prints the saved policy.",
43
- usage: "xano policy create --goal <id> [--key KEY] [--param N.path=JSON ...] [options]",
44
- flags: [...flags, messageFlag, { name: "goal", type: "string", required: true, description: "Goal id from the catalogue's goals" }, { name: "key", type: "string", description: "Policy key; defaults to the goal's suggested key" }, { name: "param", type: "string", description: "Repeatable N.path=JSON override; rule numbers start at 1, and the N. prefix is optional for a single-rule goal" }],
45
- examples: ["xano policy create --goal endpoints_need_login -b dev", "xano policy create --goal no_pii_in_responses --key DATA-020 --param 'fields=[\"email\",\"ssn\"]'"],
42
+ description: "Create an independent Active, Advisory policy from a platform template (the templates policy catalogue lists). Copies the template's sparse settings; every needs path must be filled with --param. Parsed natively before saving. A taken template key gets a free numeric suffix (case-insensitive); a taken explicit --key is refused. Never updates an existing policy and stores no link to the template. A recipe has no create action: a recipe id given to --template is refused with the recipe's templates to create in order with --template, one policy each, a pointer to a policy of your own (xano policy publish) for the rules no template covers, and xano policy catalogue --recipe <id> for what to set up first. Rule warnings go to stderr; -o json prints the saved policy.",
43
+ usage: "xano policy create --template <id> [--key KEY] [--param N.path=JSON ...] [options]",
44
+ flags: [...flags, messageFlag, { name: "template", type: "string", required: true, description: "Template id from the catalogue's templates" }, { name: "key", type: "string", description: "Policy key; defaults to the template's suggested key" }, { name: "param", type: "string", description: "Repeatable N.path=JSON override; rule numbers start at 1, and the N. prefix is optional for a single-rule template" }],
45
+ examples: ["xano policy create --template endpoints_need_login -b dev", "xano policy create --template no_pii_in_responses --key DATA-020 --param 'fields=[\"email\",\"ssn\"]'"],
46
46
  },
47
47
  {
48
48
  name: "policy parse",
@@ -53,7 +53,7 @@ workspace pull writes policies to policies/<KEY>.xs when the credential can read
53
53
  examples: ["xano policy parse policies/AUTH-EXAMPLE.xs", "xano policy parse --file policies/AUTH-EXAMPLE.xs", "cat policies/AUTH-EXAMPLE.xs | xano policy parse --stdin -o json"],
54
54
  },
55
55
  { name: "policy publish", description: "Parse one policy, then create or update by its stable key on the selected branch using canonical source. Prints Published KEY (Version N), or No changes to KEY (Version N) when the definition already matches what is stored. Use workspace push for an atomic multi-policy import.", usage: "xano policy publish --file <path> [options]", flags: [...flags, ...sourceFlags, messageFlag], examples: ["xano policy publish --file policies/AUTH-EXAMPLE.xs -b dev", "xano policy publish --file policies/AUTH-EXAMPLE.xs -m \"Tightened the scope\""] },
56
- { name: "policy evaluate", description: "Evaluate active policies and store a new run, then print the platform's verdict and the run's findings. Exits 2 when policy_check.blocking is true, and 0 for every other verdict; not_applicable (no active policy) prints a headline with the platform's message and is no run: nothing is stored, so there is no Not stored line and nothing new in policy runs. Only a disabled, forbidden, unavailable or errored verdict prints one warning line. A credential that may read but not write gets its findings with nothing stored, and the CLI says Not stored. --policy KEY tries that one policy alone, even if inactive: nothing is stored or audited, the latest run is untouched, nothing is gated, and each rule's clear objects are named; an inactive trial never exits 2, and a blank key is refused before any request.", usage: "xano policy evaluate [options]", flags: [...flags, { name: "policy", type: "string", description: "Try this one policy key alone (a trial: never stored or audited)" }, { name: "run-detail", type: "boolean", default: "false", description: "Also print what this run recorded: each policy's statement and each rule's name and resolved settings" }, { name: "summary", type: "boolean", default: "false", description: "Send answer: summary: answer the run summary (counts, each policy's verdict, rule results) and its first 50 findings instead of the whole run, and say which run has the rest. -o json passes that answer through" }], examples: ["xano policy evaluate -b dev -o json", "xano policy evaluate --run-detail", "xano policy evaluate --summary -o json", "xano policy evaluate --policy AUTH-001"] },
56
+ { name: "policy evaluate", description: "Evaluate active policies and store a new run, then print the platform's verdict and the run's findings. Exits 2 when policy_check.blocking is true, and 0 for every other verdict; not_applicable (no active policy) prints a headline with the platform's message and is no run: nothing is stored, so there is no Not stored line and nothing new in policy runs. Only a disabled, unavailable or errored verdict prints one warning line. A credential that may read but not write gets its findings with nothing stored, and the CLI says Not stored. --policy KEY tries that one policy alone, even if inactive: nothing is stored or audited, the latest run is untouched, nothing is gated, and each rule's clear objects are named; an inactive trial never exits 2, and a blank key is refused before any request.", usage: "xano policy evaluate [options]", flags: [...flags, { name: "policy", type: "string", description: "Try this one policy key alone (a trial: never stored or audited)" }, { name: "run-detail", type: "boolean", default: "false", description: "Also print what this run recorded: each policy's statement and each rule's name and resolved settings" }, { name: "summary", type: "boolean", default: "false", description: "Send answer: summary: answer the run summary (counts, each policy's verdict, rule results) and its first 50 findings instead of the whole run, and say which run has the rest. -o json passes that answer through" }], examples: ["xano policy evaluate -b dev -o json", "xano policy evaluate --run-detail", "xano policy evaluate --summary -o json", "xano policy evaluate --policy AUTH-001"] },
57
57
  {
58
58
  name: "policy runs",
59
59
  description: "List the runs the branch retains (only the newest twenty exist), newest first, with status, finding count, objects checked, trigger and start time. With a run id, read that one run, including one older than the latest, which policy status cannot reach: its summary (counts, each policy's verdict, rule results) and one page of its findings in the platform's order, blocking first, 100 unless --limit says otherwise; a page that is not every finding is marked (one page) and names the next page's --offset. --all reads every page instead (500 a request, saying so on stderr when there are more) and prints or returns every matching finding. The filter flags narrow the findings on the instance; a repeated flag matches any of its values. JSON output is the platform's own body: the run summaries for a list, and for one id the run summary with findings, the page's findings as an array (every one with --all), and findings_page {total, offset, limit, next_offset}, next_offset null after the last. The finding flags need a run id. --release <name> reads a release's policy check (stored when it was cut) the same way, plus its shipped policies; --release-id <id> reads it by id (exclusive with --release and --branch); --recheck checks the release again from its archive and stores the run. Needs the workspace:policy permission at read level.",
@@ -79,10 +79,11 @@ workspace pull writes policies to policies/<KEY>.xs when the credential can read
79
79
  ],
80
80
  examples: ["xano policy runs", "xano policy runs --limit 5", "xano policy runs 1674 --run-detail -o json", "xano policy runs 1674 --offset 100 --limit 100", "xano policy runs 1674 --all -o json", "xano policy runs 1674 --blocking --policy AUTH-001 --severity critical", "xano policy runs --release v1.2", "xano policy runs --release-id 12 --recheck"],
81
81
  },
82
+ { name: "policy coverage", description: "Show one object as Studio's object panel does, from the branch's latest run: the chip (Policies 1 blocking · 1 advisory, Policies ✓ 6 pass, Policies · 3 apply · not checked yet, Policies · Last check failed when a policy that applies here could not be checked, Policies · None apply), the object's findings, Blocking then Advisory, each with its policy key and title, rule name, message and Fix: hint, then the policies that apply, counted as the panel counts those with no finding here (6 passing · 1 couldn't check · 1 not checked yet), each Blocking or Advisory, failing, passing, couldn't check or not checked yet, and why it applies, and the platform's note. A policy the run passed still reads passing when the run errored on another policy. Needs only the object kind's own read permission, not workspace:policy, so every credential gets the same trimmed answer (no statements, rule settings, run ids or other objects' findings). The object is written type:id, as findings name it; the workspace object's id is the workspace's own id (workspace:17). -o json is the platform's answer. Exits 0 when it answers, and 1 on a refusal or a malformed type:id. Drafts are checked in Studio (on Save or with Check draft); the CLI reads stored definitions only.", usage: "xano policy coverage <type>:<id> [options]", args: [{ name: "object", required: true, description: "The object, written type:id (query:42, function:12, table:7); for workspace, the workspace's own id (workspace:17)" }], flags, examples: ["xano policy coverage query:42", "xano policy coverage function:12 -b dev -o json"] },
82
83
  { name: "policy delete", description: "Delete a policy from the selected branch, by policy key or by id; its Version History is kept. An unresolved name is refused naming the policies the branch does have. Prompts before deleting; --force skips the prompt. The delete sends the updated_at it listed, so a policy changed after that (for example while the prompt waited) is refused with policy_stale and nothing is deleted: run the command again. This is the only way to remove a policy from the CLI: workspace push is additive, so deleting policies/KEY.xs and pushing leaves the policy in place. Needs the workspace:policy permission at delete level.", usage: "xano policy delete <key-or-id> [options]", flags: [...flags, { name: "force", short: "f", type: "boolean", default: "false", description: "Skip the confirmation prompt; only with the user's explicit confirmation" }], examples: ["xano policy delete TMP-DX-001", "xano policy delete 922 --force -o json"] },
83
84
  {
84
85
  name: "policy status",
85
- description: "Inspect stored policy/run state without evaluating. The Enforcement column reads Mandatory or Advisory, and a finding count reads (blocking) when the latest run judged it blocking: the run evaluated the policy in its current version as active and mandatory. A policy is stale when it changed after the branch's newest run (the platform's latest_run), so that run's findings no longer describe it. Informational (exit 0) by default; with --fail-on-findings it exits 2 when the latest run has blocking findings, else 1 for stale, missing or errored evaluation evidence (advisory findings still exit 0), and a nonzero exit is always explained by one line naming the reason. A blocking reason is a prediction: the merge gate evaluates the branch again before a merge. In -o json each row's status is one of pass, fail, error, stale, not_evaluated, no_checks, no_objects_checked or inactive, with blocking, rules_unchecked (a pass whose rules checked no objects) and counted (whether its findings come from the latest run's evidence); --fail-on-findings adds fail_on_findings: {exit, reason}. It reads the latest run's summary, not the whole run, so in -o json run carries each policy's finding count and verdict rather than the findings; xano policy runs <id> lists them.",
86
+ description: "Inspect stored policy/run state without evaluating. The Enforcement column reads Blocking or Advisory, and a finding count reads (blocking) when the latest run judged it blocking: the run evaluated the policy in its current version as active and blocking. A policy is stale when it changed after the branch's newest run (the platform's latest_run), so that run's findings no longer describe it. Informational (exit 0) by default; with --fail-on-findings it exits 2 when the latest run has blocking findings, else 1 for stale, missing or errored evaluation evidence (advisory findings still exit 0), and a nonzero exit is always explained by one line naming the reason. A blocking reason is a prediction: the merge gate evaluates the branch again before a merge. In -o json each row's status is one of pass, fail, error, stale, not_evaluated, no_checks, no_objects_checked or inactive, with blocking, rules_unchecked (a pass whose rules checked no objects) and counted (whether its findings come from the latest run's evidence); --fail-on-findings adds fail_on_findings: {exit, reason}. It reads the latest run's summary, not the whole run, so in -o json run carries each policy's finding count and verdict rather than the findings; xano policy runs <id> lists them.",
86
87
  usage: "xano policy status [options]",
87
88
  flags: [...flags, { name: "fail-on-findings", type: "boolean", default: "false", description: "Exit 2 when the latest run has blocking findings; otherwise exit 1 for stale, missing or errored evaluation evidence" }, { name: "run-detail", type: "boolean", default: "false", description: "Also print what the latest run recorded: each policy's statement and each rule's name and resolved settings. Summary output only" }],
88
89
  examples: ["xano policy status -b dev -o json", "xano policy status --fail-on-findings -o json", "xano policy status --run-detail"],
@@ -4,7 +4,7 @@ export const historyDoc = {
4
4
  description: `History endpoints provide audit logs for API requests and background executions. Use for debugging, monitoring, and compliance.
5
5
 
6
6
  ## Available History Types
7
- - **Request History**: All API requests with timing and responses
7
+ - **Request History**: All API requests with timing and responses (a Metadata API call that carries policy details is masked for a viewer without workspace:policy read)
8
8
  - **Function History**: Function execution logs
9
9
  - **Task History**: Scheduled task execution logs
10
10
  - **Middleware History**: Middleware execution logs
@@ -20,7 +20,8 @@ export const historyDoc = {
20
20
  ai_hints: `- Use request history to debug API issues
21
21
  - Filter by status to find errors (4xx, 5xx)
22
22
  - Use branch filter to separate dev/prod logs
23
- - Include payload for full request/response data
23
+ - Pass include_output=true for each request's output; the input is always returned
24
+ - For a viewer without workspace:policy read (or while the policies feature is off), a Metadata API call that carries policy details (a policy route, a policy refusal, a push's policy_check, a policy document) shows "Hidden: this call carries policy details, which need workspace:policy read." as its whole input and output; an endpoint's own request history is never masked
24
25
  - History is limited to recent requests (not permanent storage)`,
25
26
  endpoints: [
26
27
  {
@@ -34,7 +35,7 @@ export const historyDoc = {
34
35
  { name: "per_page", type: "integer", default: 50, description: "Items per page (max 500)" },
35
36
  { name: "branch", type: "string", description: "Filter by branch name" },
36
37
  { name: "api_id", type: "integer", description: "Filter by API endpoint ID" },
37
- { name: "include_payload", type: "boolean", default: false, description: "Include request/response payloads" }
38
+ { name: "include_output", type: "boolean", default: false, description: "Include each request's output (response); the input is always returned" }
38
39
  ]
39
40
  },
40
41
  {
@@ -53,7 +54,8 @@ export const historyDoc = {
53
54
  status: { type: "array", description: "Filter by status codes (e.g., [200, 201])" },
54
55
  verb: { type: "array", description: "Filter by HTTP methods (e.g., ['GET', 'POST'])" },
55
56
  from_date: { type: "string", description: "Start date (ISO format)" },
56
- to_date: { type: "string", description: "End date (ISO format)" }
57
+ to_date: { type: "string", description: "End date (ISO format)" },
58
+ include_output: { type: "boolean", description: "Include each request's output (response); the input is always returned" }
57
59
  }
58
60
  }
59
61
  },
@@ -32,7 +32,7 @@ export const policyDoc = {
32
32
  title: "Workspace Policies",
33
33
  description: `Policies are branch-scoped workspace XanoScript objects combining a human description and deterministic check rules. These endpoints require a platform build with policy support. Discover supported checks and their exact parameter schemas from the instance; do not invent checks or parameters. The policy language - syntax, fields, rules, refusal messages and versioning - is documented once, in xano_xanoscript_docs({topic: "policies"}) (mode: "quick_reference" for the short form; the full topic carries every check's description); this topic covers the routes.
34
34
 
35
- Every route needs the workspace:policy permission: read for the reads, parse, the object lookup and evaluate; create, update or delete for the writes. An OAuth token is also capped by its workspace:read or workspace:write ceiling. A refusal is a 403 whose payload.code names the gate: policy_feature_disabled, policy_permission_required or policy_scope_required (both with permission and level). The OAuth ceiling answers insufficient_scope without a code, and a write from a read-only session (a read-only Studio session or a read-only impersonation) is refused without a code too: This is a read-only session. Enable editing to modify this resource. The policies topic's Permissions section says what each one needs.
35
+ Every route needs the workspace:policy permission: read for the reads, parse, the object lookup and evaluate; create, update or delete for the writes. The one exception is an object's coverage (GET policy/object/coverage), which needs only the object kind's own read permission (workspace:api for an endpoint or API group, workspace:function, workspace:database for a table, workspace:task, workspace:middleware, workspace:addon, workspace:workflow_test, workspace:tool for tools, agents and MCP servers, workspace:realtime for channels and messages, workspace:settings for the workspace; a trigger's by what it is attached to, its obj_type: workspace:database for a table trigger, workspace:tool for an agent or MCP server trigger, workspace:realtime for a realtime trigger, instance:workspace for a workspace or error trigger and for a trigger the branch does not hold, and all four for one whose obj_type cannot be resolved; a trigger the caller may not use is answered exactly as one the branch does not hold, refused naming instance:workspace or a 404 to a caller who holds it, so its existence never shows) and never workspace:policy; it refuses with 403 policy_object_permission_required {permission, level: "read", type}. An OAuth token is also capped by its workspace:read or workspace:write ceiling. A refusal is a 403 whose payload.code names the gate: policy_feature_disabled, policy_permission_required or policy_scope_required (both with permission and level). The OAuth ceiling answers insufficient_scope without a code, and a write from a read-only session (a read-only Studio session or a read-only impersonation) is refused without a code too: This is a read-only session. Enable editing to modify this resource. The policies topic's Permissions section says what each one needs.
36
36
 
37
37
  The native platform parses and formats policy source. Send source alone inside data, or structured fields without source; never both. Canonical source is server-owned. A write answers the policy as GET serves it, plus unchanged: an unchanged save writes nothing and answers unchanged: true. PUT and DELETE take an optional last_updated_at, the updated_at you last read: a write or delete over a newer change is refused with HTTP 400 and payload.code policy_stale, and nothing changes. A source error is a 400 whose payload.line and payload.col count from 1, like the message. A rule naming a check id the instance does not have is refused on parse, save and push with HTTP 400 and payload {code: "policy_unknown_check", check} (the id as written); the message names the nearest ids and the catalogue route, and a client keys its own pointer to the catalogue on the code.
38
38
 
@@ -40,26 +40,31 @@ Every policy the list, a GET and a write serve carries latest_run {run_id, inclu
40
40
 
41
41
  A rule with zero objects checked and no findings has status no_objects and message no objects checked. Older stored runs keep pass with checked: 0; readers accept both. The run and policy_check stay pass when nothing failed, and policy_check.message names the unchecked rules. Merge, publish and deploy gates read findings and are unaffected.
42
42
 
43
- A policy_check block reports an evaluation. status is one of: pass ("No policy findings."), fail ("Policies reported findings."), error ("A policy check could not run; its result is marked error."), not_applicable ("No active policies on this branch; nothing was evaluated."), disabled ("Policies are not enabled on this instance; nothing was evaluated."), forbidden ("This credential cannot read this workspace's policies (workspace:policy read); nothing was evaluated.") or unavailable ("Policy evaluation is unavailable; the import itself completed."), and message carries that sentence. blocking is true when an active mandatory policy has findings, and status is then fail even if a check errored. not_applicable, disabled and forbidden load, store and audit nothing. Evaluate answers pass, fail, error or not_applicable; the feature gate and the permission refuse it with a 403 instead. A not_applicable evaluate is no run: id 0, stored: false, the run's own status not_applicable too, and empty policies, results and findings. The workspace multidoc import answers all seven. Its findings and blocking_findings list the first 100 each, in the platform's order, beside counts {findings, blocking, errors}, total (every finding) and truncated (whether either list was cut); the stored run (run_id) has them all, and its results are whole; a draft import answers no policy_check. A tier1 tenant, ephemeral or sandbox push and its dry run, and a release built from a multidoc (release push), carry policy files while the feature is on; a tenant or sandbox push carries them without evaluating them and answers no policy_check, and a release built from a multidoc carries its files only for a caller holding workspace:policy create and update (for anyone else it carries the workspace's live-branch policies instead, and names the files in policies_skipped when they differ from the live ones). A remote tenant push, a push to a tenant without a policy table (one created before policies, until its next platform update), or any push while the feature is off leaves them out and names them once in policies_skipped {message, keys}, whose message says why ("N policy files were left out (KEY, KEY): <reason>."). With the policies feature off a workspace push and its dry run leave them out too (policy_check disabled), exports omit policies, and an archive import leaves its policies out and keeps the workspace's own, except that a replace deletes the policies of the branches it removes.
43
+ A policy_check block reports an evaluation. status is one of: pass ("No policy findings."), fail ("Policies reported findings."), error ("A policy check could not run; its result is marked error."), not_applicable ("No active policies on this branch; nothing was evaluated."), disabled ("Policies are not enabled on this instance; nothing was evaluated.") or unavailable ("Policy evaluation is unavailable; the import itself completed."), and message carries that sentence. blocking is true when an active blocking policy has findings, and status is then fail even if a check errored. not_applicable and disabled load, store and audit nothing. Evaluate answers pass, fail, error or not_applicable; the feature gate and the permission refuse it with a 403 instead. A not_applicable evaluate is no run: id 0, stored: false, the run's own status not_applicable too, and empty policies, results and findings. The workspace multidoc import answers all six. Its findings and blocking_findings list the first 100 each, in the platform's order, beside counts {findings, blocking, errors}, total (every finding) and truncated (whether either list was cut); the stored run (run_id) has them all, and its results are whole; a draft import answers no policy_check. A caller without workspace:policy read is evaluated the same way (the run is stored) but told only their own findings on the objects the import carried that they may read (an import carrying the workspace document carries the workspace object too, listed to a caller with workspace:settings read): {status, message, blocking, run_id: 0, access: "coverage", scope: "pushed_objects", findings, blocking_findings, elsewhere {total, blocking, basis}, results: [], counts, total, truncated, note}, each finding trimmed as an object's coverage trims it (below). counts are about the listed findings, except counts.errors (the branch's rules that could not run). elsewhere counts, never names, the findings on the objects it does not list: with basis "introduced", those the import introduced (on the live branch, not in the push gate's own evaluation of the branch just before the import; on any other branch, not in the branch's newest run just before the import while that run still described the branch); with basis "all", when no such baseline was known, every finding there, existing ones included. Which objects are the caller's follows the coverage route's permissions, a trigger by its obj_type. blocking is what a reader's import of the same change says (the branch holds a blocking finding after it), so it can be true with nothing listed; status is fail when anything is listed, elsewhere.total is above 0 or blocking is true, else error when a rule errored, else pass. An older platform answers such a caller forbidden ("This credential cannot read this workspace's policies (workspace:policy read); nothing was evaluated.") and evaluates nothing. A tier1 tenant, ephemeral or sandbox push and its dry run, and a release built from a multidoc (release push), carry policy files while the feature is on; a tenant or sandbox push carries them without evaluating them and answers no policy_check, and a release built from a multidoc carries its files only for a caller holding workspace:policy create and update (for anyone else it carries the workspace's live-branch policies instead, and names the files in policies_skipped when they differ from the live ones). A remote tenant push, a push to a tenant without a policy table (one created before policies, until its next platform update), or any push while the feature is off leaves them out and names them once in policies_skipped {message, keys}, whose message says why ("N policy files were left out (KEY, KEY): <reason>."). With the policies feature off a workspace push and its dry run leave them out too (policy_check disabled), exports omit policies, and an archive import leaves its policies out and keeps the workspace's own, except that a replace deletes the policies of the branches it removes.
44
44
 
45
- Gates: a merge, a set-live, an archive import with mode=merge, and a save or a non-draft push to the workspace's live branch are refused with HTTP 403 and payload.code policy_gate when they introduce a blocking finding or leave one on an object they change; existing findings elsewhere never block. The payload is {gate, status, total, introduced, changed, existing, run_id, can_override, findings (first 100, policy readers only), truncated}. A tenant release deploy is refused the same way when the release's own policy check has any blocking finding, existing debt included: it judges the release alone, never against the tenant's current release, so a release gets the same verdict on every tenant (ephemeral and sandbox tenants get it with gated false and are never refused). Its payload is {gate, status, total, run_id, can_override, gated, release {id, name, run_id, status, counts, carried}, message, findings, truncated}. A caller with workspace:policy update may proceed by resending with override_reason (the create and save routes of the gated objects, the multidoc, upload, import and branch live routes, a release deploy with set_live and import-schema with setlive; override_policy with the reason on tenant deploys), which is audited. A release deploy with set_live and an import-schema with setlive land the new branch first and then run the set-live gate, so a refusal keeps that branch and names it in payload.branch {id, label}. Gates are decided by the policies the branch will have after the change (a merge's carried policies, a push's policy files, the set-live candidate's own policies), so a merge, a push to the live branch or a set-live that weakens a policy active and mandatory on the branch (demotes, deactivates or deletes it, or loosens a rule) needs workspace:policy update: otherwise it is refused before anything is written with 403 policy_weakening_permission_required and {gate, permission, level, policies}, which override_reason does not lift, and the push dry run is refused the same way. A set-live of a branch that landed no policy (an import-schema with setlive always leaves the archive's policies out; a release may carry none) is judged by the live branch's policies, with no weakening check. A set-live check that cannot read the policies fails closed (only update proceeds; the refusal carries unavailable: true). Deleting an active mandatory policy needs workspace:policy update as well as delete (the same 403, gate delete), and so does an archive import with mode=replace or delete=true that would remove one from the branch it writes (gate archive_import). The publish gate covers the draftable kinds (function, query, task, middleware, addon, tool, workflow test, trigger and realtime message), agents, MCP servers and realtime channels: tables, API groups, environment variables, workspace and branch settings, realtime servers, and MCP prompts and resources are saved without it, even on the live branch, and the next run reports what they break while a set-live or tenant deploy that carries it is gated. Adding a prompt or resource to an MCP server, or removing one, changes the server, so that save is gated. A push to the live branch needs its transaction (400 policy_gate_transaction_required). Pushes to other branches are not gated: they answer policy_check after the import. A create past the plan's per-branch policy cap (lower plans cap the policies on each branch; Pro and above are unlimited) is refused with 403 policy_plan_limit; a create whose rules exactly match a live policy on the branch with 400 policy_duplicate (with existing_key, existing_id and policies); a draft import carrying a changed policy with 400 policy_draft_import (Policies are saved directly, not drafted.).
45
+ Gates: a merge, a set-live, an archive import with mode=merge, and a save or a non-draft push to the workspace's live branch are refused with HTTP 403 and payload.code policy_gate when they introduce a blocking finding or leave one on an object they change; existing findings elsewhere never block. The message names the policies the blocking findings come from to every caller, e.g. Push refused: 2 blocking policy findings from AUTH-010 and PII-001 (1 introduced by this change, 1 on objects it changes). The payload is {gate, status, total, introduced, changed, existing, run_id, can_override, sources, findings (first 100, policy readers only), truncated (policy readers only)}. sources is the message's list ("from AUTH-010 and PII-001"), to every caller whenever the blocking findings name a policy; every gate answer carries it (a merge's and its dry run's policy_gate, a set-live's, the tenant deploy gate's and a refusal's payload). A tenant release deploy is refused the same way when the release's own policy check has any blocking finding, existing debt included: it judges the release alone, never against the tenant's current release, so a release gets the same verdict on every tenant (ephemeral and sandbox tenants get it with gated false and are never refused). A rule that cannot run on an active blocking policy makes the branch gates unavailable, and the change goes through ungated until every rule can run; a tenant deploy still refuses a release with blocking findings, and a release without one whose check has a rule that could not run is unavailable and not gated. Its payload is {gate, status, total, run_id, can_override, gated, release {id, name, run_id, status, counts, carried}, message, sources, findings, truncated}, findings and truncated for policy readers only, its message naming the blocking policies to everyone. A caller with workspace:policy update may proceed by resending with override_reason (the create and save routes of the gated objects, the multidoc, upload, import and branch live routes, a release deploy with set_live and import-schema with setlive; override_policy with the reason on tenant deploys), which is audited. A release deploy with set_live and an import-schema with setlive land the new branch first and then run the set-live gate, so a refusal keeps that branch and names it in payload.branch {id, label}. Gates are decided by the policies the branch will have after the change (a merge's carried policies, a push's policy files, the set-live candidate's own policies). Each policy change needs only its own workspace:policy level, an active blocking policy included: update to edit one, delete to delete one; a set-live needs no policy permission. The audit log labels a change to an active blocking policy blocking_policy_changed and its deletion blocking_policy_deleted. A set-live of a branch that landed no policy (an import-schema with setlive always leaves the archive's policies out; a release may carry none) is judged by the live branch's policies. An archive import with mode=replace or delete=true that would remove a policy from the branch it writes needs workspace:policy delete. The publish gate covers the draftable kinds (function, query, task, middleware, addon, tool, workflow test, trigger and realtime message), agents, MCP servers and realtime channels: tables, API groups, environment variables, workspace and branch settings, realtime servers, and MCP prompts and resources are saved without it, even on the live branch, and the next run reports what they break while a set-live or tenant deploy that carries it is gated. Adding a prompt or resource to an MCP server, or removing one, changes the server, so that save is gated. A push to the live branch needs its transaction (400 policy_gate_transaction_required). Pushes to other branches are not gated: they answer policy_check after the import. A create past the plan's per-branch policy cap (lower plans cap the policies on each branch; Pro and above are unlimited) is refused with 403 policy_plan_limit; a save whose key another live policy on the branch holds (compared case-insensitively) with 400 policy_key_taken (with key, existing_key and existing_id, null when a concurrent create took the key first); a create whose rules exactly match a live policy on the branch with 400 policy_duplicate (with existing_key, existing_id and policies); a draft import carrying a changed policy with 400 policy_draft_import (Policies are saved directly, not drafted.).
46
46
 
47
47
  Releases carry their branch's policies and store a policy check when cut. An uploaded release archive (release/import) that says it carries policies needs workspace:policy create and update, or is refused with 403 policy_permission_required and nothing is stored. Routes: GET /workspace/{workspace_id}/release/{release_id}/policy_run (POST re-checks it), .../policy_run/findings, and GET /workspace/{workspace_id}/release/policy_check?release_id[]= for several (at most 200 ids). GET /workspace/{workspace_id}/tenant/{tenant_name}/policy_gate?release_name= previews a tenant deploy's gate, and GET /workspace/{workspace_id}/tenant/{tenant_name}/policy lists a tenant's policies; both need tenant_center read besides workspace:policy read.
48
48
 
49
49
  Policies expose active as a boolean (default true). Source always writes active = true or active = false before enforcement. Authored lifecycle is refused: policy: "lifecycle" was replaced by "active"; write active = true or active = false. Source refusals include line and column. An inactive policy may have no rules. Policies are saved directly, not drafted.
50
50
 
51
- An evaluation stores a run and its findings; it does not modify the policy. Findings arrive in one order: blocking first, then by severity, policy key, rule position (R2 before R10) and object. A run can hold tens of thousands of findings (85,855 findings is a 44 MB run), so read a large one in parts: GET run/{run_id}/summary serves it without its findings, with its counts, each policy's verdict and the facets, and GET run/{run_id}/findings serves its findings a page at a time, filtered on the instance. Evaluate with answer: "summary" answers the same way, with the first 50 findings. Checks are static: they inspect stored definitions and nothing runs at request time. A check passing is not proof of runtime behavior or compliance.`,
51
+ An evaluation stores a run and its findings; it does not modify the policy. Evaluations, the gates' included, share a small pool of slots; a slot's lease is renewed between rules while its evaluation runs, so a slow branch keeps its slot, and a worker that dies frees it when the lease runs out. Studio's merge review (not a Metadata API route) answers a member without workspace:policy read trimmed, at most 20 a minute per member and workspace (429 policy_merge_review_rate_limited with retry_after; a reader's review is not limited). Findings arrive in one order: blocking first, then by severity, policy key, rule position (R2 before R10) and object. A run can hold tens of thousands of findings (85,855 findings is a 44 MB run), so read a large one in parts: GET run/{run_id}/summary serves it without its findings, with its counts, each policy's verdict and the facets, and GET run/{run_id}/findings serves its findings a page at a time, filtered on the instance. Evaluate with answer: "summary" answers the same way, with the first 50 findings. Checks are static: they inspect stored definitions and nothing runs at request time. A check passing is not proof of runtime behavior or compliance. Drafts are checked in Studio only (on a XanoScript save or with Check draft, nothing stored); the Metadata API has no draft check, so evaluate after a change is saved or pushed.`,
52
52
  ai_hints: `Use the authenticated Xano MCP policy tools when available. Their workspace and instance come from the authenticated request, not tool arguments. The standalone developer MCP offers documentation and local language-server validation; it does not carry a workspace credential. Validate policy source with the native policy/parse endpoint before saving; the developer MCP's local validation is a preview against its bundled catalogue. Key refusals on payload.code, never on the message wording. Read latest_run.stale to know whether a run still describes a policy. Evaluate with answer: "summary" and page a run's findings with GET run/{run_id}/findings rather than reading a large run whole. Re-sending an identical definition is safe: the platform answers unchanged: true and writes nothing, so do not add a cosmetic edit to force a new version.`,
53
53
  related_topics: ["workspace", "branch", "authentication"],
54
54
  endpoints: [
55
- { method: "GET", path: prefix + "/check", description: "The check catalogue: items (each check's id, label, description, keywords, supported object kinds and full parameter schema) and goals (the outcomes a new policy can start from, each with the title, statement, key, severity and rules it seeds, the needs the author fills and a limits note on what its rules cannot see; see the policies topic).", parameters: [workspace] },
55
+ { method: "GET", path: prefix + "/check", description: "The check catalogue: items (each check's id, label, description, keywords, uses (goals in a customer's words, each {goal, params, note?} with the params that achieve it), supported object kinds and full parameter schema), templates (the starting points a new policy can be created from, each with its category id, framework tag ids, title, summary, key, severity and the rules it seeds, the needs the author fills (every one, or at least one when the rule's needs_any is true), examples (a map from a needs path to an example value that fits the template, {} when it gives none; a hint, never a value to save) and a limits note on what its rules cannot see; see the policies topic) template_categories (the category ids with their labels, in the order to offer them), template_frameworks (the framework tag ids with their labels, in order: a tag marks a related topic and never means a policy or workspace is compliant) template_frameworks_note (the sentence to show wherever the tags appear), recipes (goals that take several templates, each {id, title, summary, keywords, frameworks, prerequisites, templates, rules, limits}: what to set up first, the template ids to create in order, one policy each, the {title, check, params, needs} rules no template covers, created together in one policy, and the not_checkable ids no rule there can see; nothing creates a recipe), not_checkable ({id, topic, why, keywords}: what no check can see) and statement_groups (the statement names a rule is written with, by what they do, each {id, label, note, statements: [{name, params}]} with the params checks read on it).", parameters: [workspace] },
56
56
  { method: "GET", path: prefix, description: "List policies on a branch, 1000 a page (nextPage says whether there are more). Each item is served as GET serves one policy, with latest_run.", parameters: [workspace, branch, { name: "page", type: "integer", in: "query", default: 1, description: "Page number" }] },
57
57
  { method: "GET", path: prefix + "/{policy_id}", description: "Read one policy on the selected branch, with latest_run. source is canonical, so it can be sent back to PUT unchanged (a no-op) or edited. A policy that is not live on the branch answers 404 Policy not found on this branch of the workspace., as PUT and DELETE do.", parameters: [workspace, policyId, branch] },
58
58
  {
59
59
  method: "GET", path: prefix + "/object", description: "The active policies whose rules reach one object, why each rule applies, and that object's findings in the branch's newest run. An unknown type is a 400 naming the known types; an object the branch does not have is a 404.",
60
- parameters: [workspace, branch, { name: "type", type: "string", required: true, in: "query", description: "Object kind as findings name it: query, function, table, task, trigger, message and the other kinds the catalogue lists" }, { name: "id", type: "integer", required: true, in: "query", description: "Object ID on the selected branch" }],
60
+ parameters: [workspace, branch, { name: "type", type: "string", required: true, in: "query", description: "Object kind as findings name it: query, function, table, task, trigger, message and the other kinds the catalogue lists" }, { name: "id", type: "integer", required: true, in: "query", description: "Object ID on the selected branch; for workspace, the workspace's own id" }],
61
61
  response: { type: "object", description: "{object, policies: [{id, key, title, statement, severity, active, enforcement, tag, rules: [{id, title, check, label, reason, warnings}], latest_run}], run: {id, started_at, status, policies: [{key, blocking}]} | null, findings}. policies come from the policies as they are now; findings come from the newest stored run, and run.policies names each policy whose findings are listed, with blocking from the run's snapshot." },
62
62
  },
63
+ {
64
+ method: "GET", path: prefix + "/object/coverage", description: "One object's coverage for anyone who may read the object: the active policies that apply to it and why, and its findings in the branch's newest run, trimmed. Needs the object kind's own read permission, never workspace:policy (403 policy_object_permission_required {permission, level, type}: Reading this function needs the workspace:function read permission.), and answers every caller, policy readers included, the same trimmed shape (a reader wanting more reads GET /policy/object). An unknown type is a 400 naming the known types; an object the branch does not have is a 404 No <type> with id <id> on this branch. The answer is the same for every caller and is cached for 60 s by object, the branch's latest run and the workspace checksum with the policies' fingerprint, so a write, a policy change or a new run misses the cache. Request history shows its rows Hidden to viewers without workspace:policy read, as for every policy route.",
65
+ parameters: [workspace, branch, { name: "type", type: "string", required: true, in: "query", description: "Object kind as findings name it: query, api_group, function, table, task, trigger, middleware, addon, workflow_test, tool, agent, mcp_server, channel, message or workspace" }, { name: "id", type: "integer", required: true, in: "query", description: "Object ID on the selected branch; for workspace, the workspace's own id (type=workspace&id=17 on workspace 17)" }],
66
+ response: { type: "object", description: "{access: \"coverage\", object {type, id, name, app_id?}, summary {state, applies, blocking, advisory, passing, not_checked, could_not_check}, policies: [{key, title, enforcement, blocking, status, reasons}], findings, run: {started_at, status} | null, note}. state is the panel chip: none_apply, findings (Policies <blocking> blocking · <advisory> advisory), not_checked (<applies> apply · not checked yet), check_failed (Last check failed: only when a policy that applies here could not be checked) or pass (Policies ✓ <passing> pass). policies are computed now; status is failing (a finding of it here), not_checked (no run, or the newest run did not evaluate it as it now stands, such as a policy saved after the run), could_not_check (the newest run could not check it: a rule of it could not run, or the run stopped on an error before it) or passing (the newest run checked its current version and found nothing here, even when the run errored on another policy); passing, not_checked and could_not_check count those statuses; reasons say in plain words why each applies. findings are the newest run's on this object, each {id, policy_key, policy_title, rule_title, message, blocking, deleted (the run evaluated a policy the branch no longer holds), object, check: {label, description (first sentence), fix_hint} | null}. Never sent: statements, rationale, narrative, tags, severity, rule ids, check ids, params, settings, warnings, allow fingerprints, policy or run ids, other objects' findings. note is the fixed sentence Full policy details need the workspace:policy read permission." },
67
+ },
63
68
  {
64
69
  method: "POST", path: prefix + "/parse", description: "Parse and format one policy with the native platform parser, without saving it. Send exactly one of source or data.", parameters: [workspace],
65
70
  request_body: { type: "object", properties: { source: { type: "string", description: "One complete policy XanoScript document" }, data: { type: "object", description: "Structured policy fields instead of source" }, branch: { type: "string", description: "Optional branch label to check rule warnings against" } }, example: { source: policyExample } },
@@ -95,13 +100,13 @@ An evaluation stores a run and its findings; it does not modify the policy. Find
95
100
  {
96
101
  method: "GET", path: prefix + "/run", description: "List the retained runs newest first, as summaries: the findings, per-rule results and policy snapshots are on the single run. Only a branch's newest twenty runs are retained.",
97
102
  parameters: [workspace, branch, { name: "limit", type: "integer", in: "query", default: 20, description: "How many runs to return, 1-20" }],
98
- response: { type: "object", description: "{items, curPage, nextPage, prevPage}; each item is {id, created_at, trigger, actor, started_at, finished_at, status, objects_checked, counts: {findings, blocking, errors}, policies: [{id, key, version, enforcement, status, findings, blocking, objects_checked}], branch}: each policy with its verdict in that run" },
103
+ response: { type: "object", description: "{items, curPage, nextPage, prevPage}; each item is {id, created_at, trigger, actor, started_at, finished_at, status, objects_checked, counts: {findings, blocking, errors}, policies: [{id, key, version, enforcement, status, findings, blocking, objects_checked, errors}], branch}: each policy with its verdict in that run, errors counting its rules that could not run (0 while the run is in flight)" },
99
104
  },
100
105
  { method: "GET", path: prefix + "/run/{run_id}", description: "Read one retained run in full: findings, per-rule results and the policies[] snapshot of what it checked (each policy's statement and, per rule, its label and resolved params). A run is served whole, all its findings included, so read a large one through its summary and findings pages below. An evicted run or another branch's answers 404 Policy run not found on this branch of the workspace, as its summary and findings do. Only a branch's newest runs are retained.", parameters: [workspace, branch, runId] },
101
106
  {
102
107
  method: "GET", path: prefix + "/run/{run_id}/summary", description: "Read one retained run without its findings: what it adds up to, stored with the run when it was kept (a run kept before summaries is summarised on read).",
103
108
  parameters: [workspace, branch, runId, { name: "object_limit", type: "integer", in: "query", default: 100, description: "The most objects the object facet names, 1-1000; facets.object.total counts them all" }],
104
- response: { type: "object", description: "{id, created_at, updated_at, trigger, actor, started_at, finished_at, status, objects_checked, branch, counts: {findings, blocking, advisory, errors}, policy_check, policies, results, zero_object_rules, facets}. policies is the snapshot, each policy with its verdict {status, findings, blocking, objects_checked}; each result carries its finding count (findings); zero_object_rules lists {policy_key, rule_id} for the rules with no_objects (or older pass with checked: 0); facets {policy, severity, kind, object: {items, total}, tag, object_tags_from} count the findings by each, split into blocking and advisory. policy_check is the verdict a Run checks run kept, with blocking_total in place of blocking_finding_ids, and null for other runs." },
109
+ response: { type: "object", description: "{id, created_at, updated_at, trigger, actor, started_at, finished_at, status, objects_checked, branch, counts: {findings, blocking, advisory, errors}, policy_check, policies, results, zero_object_rules, facets}. policies is the snapshot, each policy with its verdict {status, findings, blocking, objects_checked, errors}, errors counting its rules that could not run; each result carries its finding count (findings); zero_object_rules lists {policy_key, rule_id} for the rules with no_objects (or older pass with checked: 0); facets {policy, severity, kind, object: {items, total}, tag, object_tags_from} count the findings by each, split into blocking and advisory. policy_check is the verdict a Run checks run kept, with blocking_total in place of blocking_finding_ids, and null for other runs." },
105
110
  },
106
111
  {
107
112
  method: "GET", path: prefix + "/run/{run_id}/findings", description: "Read one page of a retained run's findings, in the platform's order, filtered and searched on the instance. A list filter matches a finding when any of its values does, and a page holds the findings that match every filter given. Send a list with indexed keys: policy[0]=A&policy[1]=B.",
@@ -127,7 +132,7 @@ An evaluation stores a run and its findings; it does not modify the policy. Find
127
132
  },
128
133
  {
129
134
  method: "GET", path: "/workspace/{workspace_id}/agent-skills",
130
- description: "Serve the generated xano-policies agent skill. One generator, three surfaces: studio (the default, the variant the Studio agent loads), cli (the variant xano skills pull writes) and mcp (the variant the authenticated MCP's xano_get_policy_skill serves). With digest=true and surface studio or mcp it also answers xano-active-policies, a budgeted digest of the branch's active policies (mandatory first, one line per rule) when the branch has one. Each surface has its own description. The check catalogue inside it is generated from the live registry at request time, so it can never document a check this instance does not have. A workspace knowledge record named xano-policies replaces the platform skill and is served instead. Needs the workspace:policy permission at read level, like the other policy routes.",
135
+ description: "Serve the generated xano-policies agent skill. One generator, three surfaces: studio (the default, the variant the Studio agent loads), cli (the variant xano skills pull writes) and mcp (the variant the authenticated MCP's xano_get_policy_skill serves). With digest=true and surface studio or mcp it also answers xano-active-policies, a budgeted digest of the branch's active policies (blocking first, one line per rule) when the branch has one. Each surface has its own description. The check catalogue inside it is generated from the live registry at request time, so it can never document a check this instance does not have. A workspace knowledge record named xano-policies replaces the platform skill and is served instead. Needs the workspace:policy permission at read level, like the other policy routes.",
131
136
  parameters: [workspace, branch, { name: "surface", type: "string", in: "query", default: "studio", enum: ["studio", "cli", "mcp"], description: "Which variant of the generated skill to return" }, { name: "digest", type: "boolean", in: "query", default: false, description: "Also answer the xano-active-policies digest item" }],
132
137
  response: { type: "object", description: "{knowledge: [...]}: the same envelope as workspace knowledge, with one item named xano-policies whose knowledge_type is skill and whose content is the skill markdown. The platform's own item has id -101." },
133
138
  },
@@ -122,7 +122,7 @@ POST /workspace/1/agent
122
122
  steps: [
123
123
  "1. `POST /workspace/{id}/request_history/search` - Search for failed requests",
124
124
  "2. Filter by status: [400, 401, 403, 404, 500]",
125
- "3. Use include_payload=true to see request/response details",
125
+ "3. Use include_output=true to see each request's output (the input is always returned)",
126
126
  "4. `GET /workspace/{id}/apigroup/{id}/api/{id}?include_xanoscript=true` - Review endpoint code"
127
127
  ]
128
128
  }
@@ -112,12 +112,13 @@ const SYNTAX_SUGGESTIONS = [
112
112
  /**
113
113
  * Enhance error message with helpful suggestions
114
114
  */
115
- function enhanceErrorMessage(message, code, lineNumber) {
115
+ function enhanceErrorMessage(message, code, lineNumber, scheme) {
116
116
  let enhanced = message;
117
117
  const lines = code.split("\n");
118
118
  const errorLine = lines[lineNumber] || "";
119
- // Check for type aliases
120
- for (const [alias, correct] of Object.entries(TYPE_ALIASES)) {
119
+ // Check for type aliases, never in a policy: it declares no types, and a value such as
120
+ // object.naming's name_kind: "object" is not one.
121
+ for (const [alias, correct] of scheme === "policy" ? [] : Object.entries(TYPE_ALIASES)) {
121
122
  const regex = new RegExp(`\\b${alias}\\b`, "i");
122
123
  if (regex.test(errorLine)) {
123
124
  enhanced += `\n\n💡 Suggestion: Use "${correct}" instead of "${alias}"`;
@@ -213,7 +214,7 @@ function validateCode(code, filePath) {
213
214
  const endLines = text.substring(0, endOffset + 1).split("\n");
214
215
  const endLine = endLines.length - 1;
215
216
  const endCharacter = endLines[endLines.length - 1].length;
216
- const enhancedMessage = enhanceErrorMessage(item.message, text, line);
217
+ const enhancedMessage = enhanceErrorMessage(item.message, text, line, scheme);
217
218
  return {
218
219
  severity,
219
220
  range: {
@@ -341,7 +341,7 @@ export function readXanoscriptDocsV2(docsPath, args) {
341
341
  `- file_path='api/users/create.xs' — auto-select the docs for the file you're editing`,
342
342
  `- filter='round' — one expression filter's signature and example (comma-separate for several, e.g. filter='to_upper,split')`,
343
343
  `- tier='survival' (~${tiers.survival.tokens}) or tier='working' (~${tiers.working.tokens}) for context-limited models`,
344
- `- topic='policies' — when the workspace has a policies/ folder: keep to its active mandatory policies while changing code, and evaluate after`,
344
+ `- topic='policies' — when the workspace has a policies/ folder: keep to its active blocking policies while changing code, and evaluate after`,
345
345
  `- mode='quick_reference' — compact output when you only need a reminder`,
346
346
  `- max_tokens=4000 with file_path= — stop loading once the budget is reached`,
347
347
  `- exclude_topics=['syntax'] with file_path= — skip topics you've already loaded`,
@@ -269,7 +269,8 @@ Use `xano_xanoscript_docs({ tier: "survival" })` or `xano_xanoscript_docs({ tier
269
269
  | `workspace` | Workspace-level settings: environment variables, preferences, realtime | Env Variables, Preferences |
270
270
  | `branch` | Branch-level settings: middleware, history retention, visual styling | Middleware Config, History |
271
271
  | `middleware` | Request/response interceptors for functions, queries, tasks, and tools | Pre/Post Hooks |
272
- | `policies` | Workspace policy documents: syntax, check catalogue, goals, authoring rules | Quick Reference, Permissions |
272
+ | `policies` | Workspace policy documents: syntax, check catalogue, templates, authoring rules | Quick Reference, Permissions |
273
+ | `policy-templates` | The platform's policy templates: key, title, checks, framework tags and what each leaves to fill, with an example; recipes for goals that take several; what no check can see | Using a template, Recipes, What no check can see |
273
274
 
274
275
  ### Development
275
276
 
@@ -310,6 +310,12 @@
310
310
  "exclusive": true,
311
311
  "priority": 3,
312
312
  "aliases": ["policy", "governance"]
313
+ },
314
+ "policy-templates": {
315
+ "file": "policy-templates.md",
316
+ "description": "The platform's policy templates by category: key, title, checks, framework tags and the settings each leaves to fill, with an example; recipes for goals that take several templates; what no check can see",
317
+ "applyTo": [],
318
+ "aliases": ["policy-template"]
313
319
  }
314
320
  },
315
321