Browse the docs

lint_macro

Checks macro JSON against the schema and the lint rules without saving it.

Details #

An agent sends a macro and gets back either the problems or a clean bill. The missing fields an agent usually leaves out (id, enabled, when, onlyIf, dates) are filled in first, the way create_macro does, so a minimal macro can be checked.

{ "jsonrpc": "2.0", "id": 5, "method": "tools/call",
  "params": { "name": "lint_macro", "arguments": { "json": {
    "name": "Say hello",
    "do": [{ "id": "s1", "type": "hud", "params": { "text": "Hello" } }]
  } } } }

A clean macro answers:

{ "ok": true, "warnings": [] }

A broken one returns an error result listing up to 20 problems, one per line:

{ "content": [{ "type": "text", "text": "Not a valid macro:\n- do[0].params: ..." }], "isError": true }

Gotchas #

  • A group that does not exist is an error, and the message lists the groups there are.

  • Lint errors fail; lint warnings are returned in warnings and do not.

See also #