{
  "version": "2026-12-06",
  "operations": [
    {
      "name": "accounts.search",
      "toolName": "accounts_search",
      "group": "accounts",
      "title": "Search or list customer accounts",
      "description": "Find customer accounts by name, city, state or contact, or list them all when no query is given. Returns one row per account with counts of machines, open orders and open tickets and the days since last contact. Use this first to get an account id before calling accounts.get.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "query": {
            "description": "Free text matched against name, city, state and contact names",
            "type": "string",
            "maxLength": 200
          },
          "segment": {
            "type": "string",
            "enum": [
              "concrete_producer",
              "multiservice"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "prospect",
              "inactive"
            ]
          },
          "state": {
            "description": "HQ state code, for example TX",
            "type": "string",
            "maxLength": 40
          },
          "health": {
            "description": "Only accounts at this health level",
            "type": "string",
            "enum": [
              "good",
              "watch",
              "at_risk"
            ]
          },
          "notContactedInDays": {
            "description": "Only accounts with no call, email, text or visit in this many days",
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "sort": {
            "default": "name",
            "type": "string",
            "enum": [
              "name",
              "last_contacted",
              "created"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string"
                },
                "normalizedName": {
                  "type": "string",
                  "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
                },
                "segment": {
                  "type": "string",
                  "enum": [
                    "concrete_producer",
                    "multiservice"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "prospect",
                    "inactive"
                  ]
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "website": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqLine1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqLine2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqState": {
                  "description": "Two-letter US state or region code",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqPostalCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqCountry": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hubspotCompanyId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ownerUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Staff user who owns the account"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lastContactedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Most recent call, email, text or visit"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "machineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "openOrderCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "primaryContactName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "daysSinceContact": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "normalizedName",
                "segment",
                "status",
                "phone",
                "website",
                "hqLine1",
                "hqLine2",
                "hqCity",
                "hqState",
                "hqPostalCode",
                "hqCountry",
                "hubspotCompanyId",
                "ownerUserId",
                "notes",
                "lastContactedAt",
                "createdAt",
                "updatedAt",
                "machineCount",
                "openOrderCount",
                "openTicketCount",
                "primaryContactName",
                "daysSinceContact"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "accounts.get",
      "toolName": "accounts_get",
      "group": "accounts",
      "title": "Get the full account overview",
      "description": "Everything on one customer account: profile, health, contacts, sites, machines with warranty status, orders, open tickets, parts orders, open tasks, the 50 most recent activities, opportunities, documents and portal users. This is the data behind the account page.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Account id"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "normalizedName": {
                "type": "string",
                "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
              },
              "segment": {
                "type": "string",
                "enum": [
                  "concrete_producer",
                  "multiservice"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "prospect",
                  "inactive"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqState": {
                "description": "Two-letter US state or region code",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqPostalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCountry": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hubspotCompanyId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Staff user who owns the account"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastContactedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Most recent call, email, text or visit"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "name",
              "normalizedName",
              "segment",
              "status",
              "phone",
              "website",
              "hqLine1",
              "hqLine2",
              "hqCity",
              "hqState",
              "hqPostalCode",
              "hqCountry",
              "hubspotCompanyId",
              "ownerUserId",
              "notes",
              "lastContactedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "health": {
            "type": "object",
            "properties": {
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "score": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100,
                "description": "100 is healthiest"
              },
              "level": {
                "type": "string",
                "enum": [
                  "good",
                  "watch",
                  "at_risk"
                ]
              },
              "openTickets": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "downMachines": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "downtimeDays90": {
                "type": "number",
                "description": "Machine-days down in the last 90 days"
              },
              "partsSpendCents365": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Parts ordered in the last 365 days"
              },
              "daysSinceContact": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machinesUnderWarranty": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "warrantiesExpiringSoon": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "overdueTasks": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Plain-language reasons behind the score"
              }
            },
            "required": [
              "accountId",
              "score",
              "level",
              "openTickets",
              "downMachines",
              "downtimeDays90",
              "partsSpendCents365",
              "daysSinceContact",
              "machinesUnderWarranty",
              "warrantiesExpiringSoon",
              "overdueTasks",
              "reasons"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "firstName": {
                  "type": "string"
                },
                "lastName": {
                  "type": "string"
                },
                "role": {
                  "description": "Job title or role at the customer, for example Plant manager",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "mobile": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "preferredChannel": {
                  "type": "string",
                  "enum": [
                    "email",
                    "phone",
                    "text"
                  ]
                },
                "isPrimary": {
                  "type": "boolean"
                },
                "hubspotContactId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "firstName",
                "lastName",
                "role",
                "email",
                "mobile",
                "phone",
                "preferredChannel",
                "isPrimary",
                "hubspotContactId",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "sites": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string"
                },
                "line1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "line2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "state": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "postalCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "longitude": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "powerSource": {
                  "description": "For example utility 480V three-phase, or generator",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "waterSource": {
                  "description": "For example municipal, well, hauled",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "activeFrom": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "activeTo": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Set when the site is no longer used"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "name",
                "line1",
                "line2",
                "city",
                "state",
                "postalCode",
                "country",
                "latitude",
                "longitude",
                "powerSource",
                "waterSource",
                "activeFrom",
                "activeTo",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "machines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "longitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "siteCity",
                "siteState",
                "latitude",
                "longitude",
                "openTicketCount"
              ],
              "additionalProperties": false
            }
          },
          "orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Delivery site"
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "stageDates": {
                  "type": "object",
                  "properties": {
                    "received": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "in_build": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ready_to_ship": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "shipped": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivered": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "set_up": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "commissioned": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "trained": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "closed": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ],
                  "additionalProperties": false,
                  "description": "Date each stage was reached; null if not yet"
                },
                "signedQuoteDocumentId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signedQuoteReceivedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "balanceRemainingCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null until someone records it; 0 means paid in full"
                },
                "isValid": {
                  "type": "boolean"
                },
                "financingPartner": {
                  "type": "string",
                  "enum": [
                    "none",
                    "commercial_capital",
                    "northland_capital",
                    "other"
                  ]
                },
                "financingStatus": {
                  "type": "string",
                  "enum": [
                    "not_applicable",
                    "pending",
                    "approved",
                    "declined",
                    "funded"
                  ]
                },
                "financingNotes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "poNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expectedShipOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ownerUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "missing": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "signed_quote",
                      "signed_quote_received_on",
                      "balance_remaining"
                    ]
                  }
                },
                "nextStage": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "received",
                        "in_build",
                        "ready_to_ship",
                        "shipped",
                        "delivered",
                        "set_up",
                        "commissioned",
                        "trained",
                        "closed"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "machineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderNumber",
                "accountId",
                "siteId",
                "title",
                "stage",
                "stageDates",
                "signedQuoteDocumentId",
                "signedQuoteReceivedOn",
                "totalCents",
                "balanceRemainingCents",
                "isValid",
                "financingPartner",
                "financingStatus",
                "financingNotes",
                "poNumber",
                "expectedShipOn",
                "ownerUserId",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "missing",
                "nextStage",
                "lineCount",
                "machineCount"
              ],
              "additionalProperties": false
            }
          },
          "openTickets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "mechanical",
                    "electrical",
                    "controls",
                    "hydraulic",
                    "pneumatic",
                    "structural",
                    "calibration",
                    "operator_training",
                    "other"
                  ]
                },
                "priority": {
                  "type": "string",
                  "enum": [
                    "low",
                    "normal",
                    "high",
                    "down"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "new",
                    "diagnosing",
                    "parts_on_order",
                    "scheduled",
                    "waiting_on_customer",
                    "resolved",
                    "follow_up_complete"
                  ]
                },
                "rootCause": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "component_failure",
                        "manufacturing_defect",
                        "wear",
                        "operator_error",
                        "installation",
                        "shipping_damage",
                        "environment",
                        "design",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolution": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "staff",
                    "portal",
                    "email",
                    "agent"
                  ]
                },
                "assignedToUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isWarranty": {
                  "type": "boolean",
                  "description": "Whether the work is covered by warranty"
                },
                "onsiteHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total on-site hours logged"
                },
                "travelHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel hours logged"
                },
                "travelMiles": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel miles logged"
                },
                "openedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "scheduledFor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolvedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "machineModel": {
                  "type": "string"
                },
                "assignedToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "ticketNumber",
                "accountId",
                "machineId",
                "contactId",
                "title",
                "description",
                "category",
                "priority",
                "status",
                "rootCause",
                "resolution",
                "source",
                "assignedToUserId",
                "isWarranty",
                "onsiteHours",
                "travelHours",
                "travelMiles",
                "openedAt",
                "scheduledFor",
                "resolvedAt",
                "createdAt",
                "updatedAt",
                "accountName",
                "machineSerialNumber",
                "machineModel",
                "assignedToName"
              ],
              "additionalProperties": false
            }
          },
          "partsOrders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "quote",
                    "ordered",
                    "shipped",
                    "delivered",
                    "cancelled"
                  ]
                },
                "subtotalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "shippingCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "taxCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "quotedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "quoteValidUntil": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "deliveredOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "carrier": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "trackingNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "shipToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "shipToAddress": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customerPo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "lineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderNumber",
                "accountId",
                "contactId",
                "machineId",
                "ticketId",
                "status",
                "subtotalCents",
                "shippingCents",
                "taxCents",
                "totalCents",
                "quotedOn",
                "quoteValidUntil",
                "orderedOn",
                "shippedOn",
                "deliveredOn",
                "carrier",
                "trackingNumber",
                "shipToName",
                "shipToAddress",
                "customerPo",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "lineCount"
              ],
              "additionalProperties": false
            }
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "task",
                    "call",
                    "visit",
                    "delivery",
                    "commissioning",
                    "service",
                    "check_in"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "open",
                    "done",
                    "cancelled"
                  ]
                },
                "dueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Day the task is due or the appointment happens"
                },
                "startsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Start time for timed appointments; null for all-day items"
                },
                "endsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "location": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "assignedToUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "assignedToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "accountName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "checkInId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isOverdue": {
                  "type": "boolean",
                  "description": "Open and due before today"
                },
                "googleEventId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "syncState": {
                  "type": "string",
                  "enum": [
                    "not_synced",
                    "pending",
                    "synced",
                    "error"
                  ]
                },
                "syncedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "syncError": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "completedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "type",
                "title",
                "notes",
                "status",
                "dueOn",
                "startsAt",
                "endsAt",
                "location",
                "assignedToUserId",
                "assignedToName",
                "accountId",
                "accountName",
                "contactId",
                "orderId",
                "machineId",
                "ticketId",
                "siteId",
                "checkInId",
                "isOverdue",
                "googleEventId",
                "syncState",
                "syncedAt",
                "syncError",
                "completedAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            },
            "description": "Open tasks, soonest first"
          },
          "activities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "call",
                    "email",
                    "text",
                    "visit",
                    "note",
                    "system"
                  ]
                },
                "direction": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "outbound",
                        "inbound"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "subject": {
                  "type": "string"
                },
                "body": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "externalRef": {
                  "description": "Gmail message id for imported emails; unique",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "externalThreadId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fromAddress": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toAddresses": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "durationMinutes": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "description": "Attachments stored as documents"
                },
                "loggedByName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "type",
                "direction",
                "subject",
                "body",
                "occurredAt",
                "accountId",
                "contactId",
                "orderId",
                "machineId",
                "ticketId",
                "externalRef",
                "externalThreadId",
                "fromAddress",
                "toAddresses",
                "durationMinutes",
                "documentIds",
                "loggedByName",
                "createdAt"
              ],
              "additionalProperties": false
            },
            "description": "Most recent 50 timeline entries"
          },
          "opportunities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "productName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Machine that prompted the add-on, if any"
                },
                "estimatedValueCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "open",
                    "handed_to_sales",
                    "won",
                    "lost"
                  ]
                },
                "handedToSalesOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "salesContact": {
                  "description": "Sales person the opportunity was handed to",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "accountName",
                "title",
                "description",
                "productId",
                "productName",
                "machineId",
                "estimatedValueCents",
                "status",
                "handedToSalesOn",
                "salesContact",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "stored"
                  ],
                  "description": "pending until the file bytes are stored"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerVisible": {
                  "type": "boolean",
                  "description": "Whether the customer can open it in the portal"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "email",
                    "portal",
                    "system",
                    "import"
                  ]
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "parts_order",
                          "part",
                          "opportunity",
                          "check_in"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      }
                    },
                    "required": [
                      "entityType",
                      "entityId"
                    ],
                    "additionalProperties": false
                  }
                },
                "uploadedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "status",
                "accountId",
                "customerVisible",
                "source",
                "links",
                "uploadedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "portalUsers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "type": "string",
                  "maxLength": 254,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "name": {
                  "type": "string"
                },
                "active": {
                  "type": "boolean"
                },
                "lastSeenAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "accountName",
                "contactId",
                "email",
                "name",
                "active",
                "lastSeenAt",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "account",
          "health",
          "contacts",
          "sites",
          "machines",
          "orders",
          "openTickets",
          "partsOrders",
          "tasks",
          "activities",
          "opportunities",
          "documents",
          "portalUsers"
        ],
        "additionalProperties": false
      },
      "view": "account"
    },
    {
      "name": "accounts.create",
      "toolName": "accounts_create",
      "group": "accounts",
      "title": "Create a customer account",
      "description": "Create an account. A duplicate check runs on the normalized company name (and HubSpot company id); if a match exists the call fails with a conflict error listing the matches unless allowDuplicate is true. Optionally creates the first contact in the same call.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Company name as the customer writes it"
          },
          "segment": {
            "type": "string",
            "enum": [
              "concrete_producer",
              "multiservice"
            ],
            "description": "concrete_producer or multiservice"
          },
          "status": {
            "default": "active",
            "type": "string",
            "enum": [
              "active",
              "prospect",
              "inactive"
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "website": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqLine1": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqLine2": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqCity": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "hqState": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "description": "Two-letter state code, for example TX"
          },
          "hqPostalCode": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "hqCountry": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "hubspotCompanyId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "allowDuplicate": {
            "default": false,
            "description": "Create even if another account has the same normalized name",
            "type": "boolean"
          },
          "primaryContact": {
            "type": "object",
            "properties": {
              "firstName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "lastName": {
                "default": "",
                "type": "string",
                "maxLength": 100
              },
              "role": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "mobile": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "firstName"
            ]
          }
        },
        "required": [
          "name",
          "segment"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "normalizedName": {
                "type": "string",
                "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
              },
              "segment": {
                "type": "string",
                "enum": [
                  "concrete_producer",
                  "multiservice"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "prospect",
                  "inactive"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqState": {
                "description": "Two-letter US state or region code",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqPostalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCountry": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hubspotCompanyId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Staff user who owns the account"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastContactedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Most recent call, email, text or visit"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "name",
              "normalizedName",
              "segment",
              "status",
              "phone",
              "website",
              "hqLine1",
              "hqLine2",
              "hqCity",
              "hqState",
              "hqPostalCode",
              "hqCountry",
              "hubspotCompanyId",
              "ownerUserId",
              "notes",
              "lastContactedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "primaryContactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "account",
          "primaryContactId"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "accounts.update",
      "toolName": "accounts_update",
      "group": "accounts",
      "title": "Update a customer account",
      "description": "Change any profile field of an account. Only the fields you send are changed. Renaming re-runs the duplicate check against other accounts and fails with a conflict unless allowDuplicate is true.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Company name as the customer writes it"
          },
          "segment": {
            "type": "string",
            "enum": [
              "concrete_producer",
              "multiservice"
            ],
            "description": "concrete_producer or multiservice"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "prospect",
              "inactive"
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "website": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqLine1": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqLine2": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "hqCity": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "hqState": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "description": "Two-letter state code, for example TX"
          },
          "hqPostalCode": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "hqCountry": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "hubspotCompanyId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "allowDuplicate": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "normalizedName": {
                "type": "string",
                "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
              },
              "segment": {
                "type": "string",
                "enum": [
                  "concrete_producer",
                  "multiservice"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "prospect",
                  "inactive"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqState": {
                "description": "Two-letter US state or region code",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqPostalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCountry": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hubspotCompanyId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Staff user who owns the account"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastContactedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Most recent call, email, text or visit"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "name",
              "normalizedName",
              "segment",
              "status",
              "phone",
              "website",
              "hqLine1",
              "hqLine2",
              "hqCity",
              "hqState",
              "hqPostalCode",
              "hqCountry",
              "hubspotCompanyId",
              "ownerUserId",
              "notes",
              "lastContactedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "account"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "accounts.duplicate_check",
      "toolName": "accounts_duplicate_check",
      "group": "accounts",
      "title": "Check for duplicate accounts or contacts",
      "description": "Before creating or importing, check whether a company name, HubSpot company id or contact email already exists. Company names are compared in normalized form (case, punctuation and suffixes such as LLC or Inc ignored); emails are compared case-insensitively. Returns the matches, empty when there are none.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "hubspotCompanyId": {
            "type": "string",
            "maxLength": 60
          },
          "email": {
            "type": "string",
            "maxLength": 254
          },
          "excludeAccountId": {
            "description": "Ignore this account (when checking a rename)",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "excludeContactId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "normalizedName": {
            "type": [
              "string",
              "null"
            ]
          },
          "normalizedEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasDuplicates": {
            "type": "boolean"
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "account_name",
                    "hubspot_company_id",
                    "contact_email"
                  ]
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "contact": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "matchedOn": {
                  "type": "string",
                  "description": "The normalized value that matched"
                }
              },
              "required": [
                "kind",
                "account",
                "contact",
                "matchedOn"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "normalizedName",
          "normalizedEmail",
          "hasDuplicates",
          "matches"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "accounts.health",
      "toolName": "accounts_health",
      "group": "accounts",
      "title": "Get account health",
      "description": "One status for an account built from open tickets, machines down, downtime in the last 90 days, parts spend in the last year, days since last contact, warranties and overdue tasks. Returns a 0-100 score, a level (good, watch, at_risk) and the reasons in plain language.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Account id"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "100 is healthiest"
          },
          "level": {
            "type": "string",
            "enum": [
              "good",
              "watch",
              "at_risk"
            ]
          },
          "openTickets": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "downMachines": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "downtimeDays90": {
            "type": "number",
            "description": "Machine-days down in the last 90 days"
          },
          "partsSpendCents365": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Parts ordered in the last 365 days"
          },
          "daysSinceContact": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "machinesUnderWarranty": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "warrantiesExpiringSoon": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "overdueTasks": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Plain-language reasons behind the score"
          }
        },
        "required": [
          "accountId",
          "score",
          "level",
          "openTickets",
          "downMachines",
          "downtimeDays90",
          "partsSpendCents365",
          "daysSinceContact",
          "machinesUnderWarranty",
          "warrantiesExpiringSoon",
          "overdueTasks",
          "reasons"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.list",
      "toolName": "contacts_list",
      "group": "contacts",
      "title": "List or search contacts",
      "description": "List contacts, optionally for one account or matching a name, email or phone number. Each row includes the account name.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "query": {
            "description": "Matches name, email, mobile or phone",
            "type": "string",
            "maxLength": 200
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "firstName": {
                  "type": "string"
                },
                "lastName": {
                  "type": "string"
                },
                "role": {
                  "description": "Job title or role at the customer, for example Plant manager",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "mobile": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "preferredChannel": {
                  "type": "string",
                  "enum": [
                    "email",
                    "phone",
                    "text"
                  ]
                },
                "isPrimary": {
                  "type": "boolean"
                },
                "hubspotContactId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "accountId",
                "firstName",
                "lastName",
                "role",
                "email",
                "mobile",
                "phone",
                "preferredChannel",
                "isPrimary",
                "hubspotContactId",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.get",
      "toolName": "contacts_get",
      "group": "contacts",
      "title": "Get a contact",
      "description": "Read one contact by id with role, email, phone numbers, preferred channel and the account name.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "role": {
            "description": "Job title or role at the customer, for example Plant manager",
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "mobile": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferredChannel": {
            "type": "string",
            "enum": [
              "email",
              "phone",
              "text"
            ]
          },
          "isPrimary": {
            "type": "boolean"
          },
          "hubspotContactId": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "accountId",
          "firstName",
          "lastName",
          "role",
          "email",
          "mobile",
          "phone",
          "preferredChannel",
          "isPrimary",
          "hubspotContactId",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.create",
      "toolName": "contacts_create",
      "group": "contacts",
      "title": "Add a contact to an account",
      "description": "Create a contact on an account. Fails with a conflict error naming the existing contact if another contact already uses the same email (case-insensitive).",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "firstName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "lastName": {
            "default": "",
            "type": "string",
            "maxLength": 100
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ],
            "description": "Job title or role, for example Plant manager"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unique across all contacts, compared case-insensitively"
          },
          "mobile": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "preferredChannel": {
            "default": "email",
            "type": "string",
            "enum": [
              "email",
              "phone",
              "text"
            ],
            "description": "How this person prefers to be reached"
          },
          "isPrimary": {
            "default": false,
            "type": "boolean",
            "description": "Primary contact for the account; setting it clears the flag on the others"
          },
          "hubspotContactId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accountId",
          "firstName"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "role": {
                "description": "Job title or role at the customer, for example Plant manager",
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "mobile": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "preferredChannel": {
                "type": "string",
                "enum": [
                  "email",
                  "phone",
                  "text"
                ]
              },
              "isPrimary": {
                "type": "boolean"
              },
              "hubspotContactId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "firstName",
              "lastName",
              "role",
              "email",
              "mobile",
              "phone",
              "preferredChannel",
              "isPrimary",
              "hubspotContactId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "contact"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.update",
      "toolName": "contacts_update",
      "group": "contacts",
      "title": "Update a contact",
      "description": "Change fields on a contact; only the fields you send are changed. Changing the email re-runs the duplicate check. Send accountId to move the contact to another account.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "firstName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "lastName": {
            "type": "string",
            "maxLength": 100
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ],
            "description": "Job title or role, for example Plant manager"
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unique across all contacts, compared case-insensitively"
          },
          "mobile": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "preferredChannel": {
            "type": "string",
            "enum": [
              "email",
              "phone",
              "text"
            ],
            "description": "How this person prefers to be reached"
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Primary contact for the account; setting it clears the flag on the others"
          },
          "hubspotContactId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "role": {
                "description": "Job title or role at the customer, for example Plant manager",
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "mobile": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "preferredChannel": {
                "type": "string",
                "enum": [
                  "email",
                  "phone",
                  "text"
                ]
              },
              "isPrimary": {
                "type": "boolean"
              },
              "hubspotContactId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "firstName",
              "lastName",
              "role",
              "email",
              "mobile",
              "phone",
              "preferredChannel",
              "isPrimary",
              "hubspotContactId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "contact"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.delete",
      "toolName": "contacts_delete",
      "group": "contacts",
      "title": "Delete a contact",
      "description": "Remove a contact. Activities, tickets and orders that mention the contact are kept and simply lose the link. Fails with a conflict if the contact has a portal login; remove the portal user first.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.google_sync",
      "toolName": "contacts_google_sync",
      "group": "contacts",
      "title": "Sync contacts with Google Contacts now",
      "description": "Two-way sync between CRM contacts and one staff user's Google Contacts (the caller by default). Pulls changes made in Google to linked contacts (name, email, phones, job title) into the CRM, links Google contacts that share an email with a CRM contact, then pushes new and changed CRM contacts to Google. Contacts deleted in Google are unlinked, never deleted from the CRM. Returns connected false, and changes nothing, until the user connects Google Contacts. Runs every 15 minutes on its own.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "userId": {
            "description": "Staff user to sync; defaults to the caller. Admins only for someone else.",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "maxPush": {
            "default": 200,
            "description": "Most CRM contacts to push in this run",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "False when the user has not connected Google Contacts; nothing was changed"
          },
          "pushed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Google contacts created or updated from CRM contacts"
          },
          "pulled": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "CRM contacts updated from changes made in Google"
          },
          "linked": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Existing Google contacts matched to CRM contacts by email"
          },
          "removed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Links dropped because the contact was deleted in Google (the CRM contact is kept)"
          },
          "remaining": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "CRM contacts still waiting to be pushed; the next run continues"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "contactId",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "connected",
          "pushed",
          "pulled",
          "linked",
          "removed",
          "remaining",
          "errors"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "contacts.google_sync_state",
      "toolName": "contacts_google_sync_state",
      "group": "contacts",
      "title": "Google Contacts sync status",
      "description": "Whether the caller (or a given staff user) has Google Contacts connected, how many contacts are linked, when sync last ran and the last error.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "linkedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "removedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "waitingCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "CRM contacts new or changed since they were last pushed"
          },
          "lastSyncedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "connected",
          "linkedCount",
          "removedCount",
          "waitingCount",
          "lastSyncedAt",
          "lastError"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.list",
      "toolName": "sites_list",
      "group": "sites",
      "title": "List sites",
      "description": "List job sites and yards, optionally for one account or one state. Each row has GPS coordinates, the number of machines on site and the readiness checklist summary.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "state": {
            "type": "string",
            "maxLength": 40
          },
          "activeOnly": {
            "default": false,
            "description": "Leave out sites that have been closed",
            "type": "boolean"
          },
          "query": {
            "type": "string",
            "maxLength": 200
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string"
                },
                "line1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "line2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "state": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "postalCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "country": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "longitude": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "powerSource": {
                  "description": "For example utility 480V three-phase, or generator",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "waterSource": {
                  "description": "For example municipal, well, hauled",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "activeFrom": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "activeTo": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Set when the site is no longer used"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "machineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "readiness": {
                  "type": "object",
                  "properties": {
                    "siteId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "item": {
                            "type": "string",
                            "enum": [
                              "pad",
                              "power",
                              "water",
                              "access",
                              "aggregate_supply"
                            ]
                          },
                          "confirmed": {
                            "type": "boolean"
                          },
                          "confirmedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confirmedByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "item",
                          "confirmed",
                          "confirmedOn",
                          "confirmedByName",
                          "note"
                        ],
                        "additionalProperties": false
                      },
                      "description": "One entry per checklist item: pad, power, water, access, aggregate_supply"
                    },
                    "confirmedCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "totalCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "ready": {
                      "type": "boolean",
                      "description": "True when every item is confirmed"
                    }
                  },
                  "required": [
                    "siteId",
                    "items",
                    "confirmedCount",
                    "totalCount",
                    "ready"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "accountId",
                "name",
                "line1",
                "line2",
                "city",
                "state",
                "postalCode",
                "country",
                "latitude",
                "longitude",
                "powerSource",
                "waterSource",
                "activeFrom",
                "activeTo",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "machineCount",
                "readiness"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.get",
      "toolName": "sites_get",
      "group": "sites",
      "title": "Get a site",
      "description": "Read one site with its address, GPS, power and water source, machine count and readiness checklist.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string"
          },
          "line1": {
            "type": [
              "string",
              "null"
            ]
          },
          "line2": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": [
              "string",
              "null"
            ]
          },
          "postalCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              {
                "type": "null"
              }
            ]
          },
          "longitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              },
              {
                "type": "null"
              }
            ]
          },
          "powerSource": {
            "description": "For example utility 480V three-phase, or generator",
            "type": [
              "string",
              "null"
            ]
          },
          "waterSource": {
            "description": "For example municipal, well, hauled",
            "type": [
              "string",
              "null"
            ]
          },
          "activeFrom": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "activeTo": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the site is no longer used"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "machineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "readiness": {
            "type": "object",
            "properties": {
              "siteId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "item": {
                      "type": "string",
                      "enum": [
                        "pad",
                        "power",
                        "water",
                        "access",
                        "aggregate_supply"
                      ]
                    },
                    "confirmed": {
                      "type": "boolean"
                    },
                    "confirmedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "confirmedByName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "item",
                    "confirmed",
                    "confirmedOn",
                    "confirmedByName",
                    "note"
                  ],
                  "additionalProperties": false
                },
                "description": "One entry per checklist item: pad, power, water, access, aggregate_supply"
              },
              "confirmedCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "totalCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "ready": {
                "type": "boolean",
                "description": "True when every item is confirmed"
              }
            },
            "required": [
              "siteId",
              "items",
              "confirmedCount",
              "totalCount",
              "ready"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "accountId",
          "name",
          "line1",
          "line2",
          "city",
          "state",
          "postalCode",
          "country",
          "latitude",
          "longitude",
          "powerSource",
          "waterSource",
          "activeFrom",
          "activeTo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "machineCount",
          "readiness"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.create",
      "toolName": "sites_create",
      "group": "sites",
      "title": "Add a site to an account",
      "description": "Create a job site or yard for an account. Give latitude and longitude when known so machines there appear on the map. The five-item readiness checklist starts unconfirmed.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Name of the yard or job site"
          },
          "line1": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "line2": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "description": "Two-letter state code"
          },
          "postalCode": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "latitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              {
                "type": "null"
              }
            ]
          },
          "longitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              },
              {
                "type": "null"
              }
            ]
          },
          "powerSource": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "waterSource": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "activeFrom": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "activeTo": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set to close the site"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accountId",
          "name"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "site": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "longitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "powerSource": {
                "description": "For example utility 480V three-phase, or generator",
                "type": [
                  "string",
                  "null"
                ]
              },
              "waterSource": {
                "description": "For example municipal, well, hauled",
                "type": [
                  "string",
                  "null"
                ]
              },
              "activeFrom": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "activeTo": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Set when the site is no longer used"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "name",
              "line1",
              "line2",
              "city",
              "state",
              "postalCode",
              "country",
              "latitude",
              "longitude",
              "powerSource",
              "waterSource",
              "activeFrom",
              "activeTo",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "site"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.update",
      "toolName": "sites_update",
      "group": "sites",
      "title": "Update a site",
      "description": "Change fields on a site; only the fields you send are changed.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Name of the yard or job site"
          },
          "line1": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "line2": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "description": "Two-letter state code"
          },
          "postalCode": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "latitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              {
                "type": "null"
              }
            ]
          },
          "longitude": {
            "anyOf": [
              {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              },
              {
                "type": "null"
              }
            ]
          },
          "powerSource": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "waterSource": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "activeFrom": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "activeTo": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set to close the site"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "site": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "longitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "powerSource": {
                "description": "For example utility 480V three-phase, or generator",
                "type": [
                  "string",
                  "null"
                ]
              },
              "waterSource": {
                "description": "For example municipal, well, hauled",
                "type": [
                  "string",
                  "null"
                ]
              },
              "activeFrom": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "activeTo": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Set when the site is no longer used"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "name",
              "line1",
              "line2",
              "city",
              "state",
              "postalCode",
              "country",
              "latitude",
              "longitude",
              "powerSource",
              "waterSource",
              "activeFrom",
              "activeTo",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "site"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.readiness_get",
      "toolName": "sites_readiness_get",
      "group": "sites",
      "title": "Get the site readiness checklist",
      "description": "The pre-delivery checklist for a site: pad, power, water, access and aggregate supply, each confirmed or not, with who confirmed it and when. ready is true only when all five are confirmed.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "siteId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "enum": [
                    "pad",
                    "power",
                    "water",
                    "access",
                    "aggregate_supply"
                  ]
                },
                "confirmed": {
                  "type": "boolean"
                },
                "confirmedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "confirmedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "item",
                "confirmed",
                "confirmedOn",
                "confirmedByName",
                "note"
              ],
              "additionalProperties": false
            },
            "description": "One entry per checklist item: pad, power, water, access, aggregate_supply"
          },
          "confirmedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "ready": {
            "type": "boolean",
            "description": "True when every item is confirmed"
          }
        },
        "required": [
          "siteId",
          "items",
          "confirmedCount",
          "totalCount",
          "ready"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "sites.readiness_update",
      "toolName": "sites_readiness_update",
      "group": "sites",
      "title": "Confirm site readiness items",
      "description": "Mark one or more readiness checklist items confirmed or not confirmed, with an optional note. Confirming records today's date and your name. Returns the whole checklist.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "enum": [
                    "pad",
                    "power",
                    "water",
                    "access",
                    "aggregate_supply"
                  ]
                },
                "confirmed": {
                  "type": "boolean"
                },
                "confirmedOn": {
                  "description": "Defaults to today when confirming",
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                },
                "note": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 2000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "item",
                "confirmed"
              ]
            }
          }
        },
        "required": [
          "siteId",
          "items"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "enum": [
                    "pad",
                    "power",
                    "water",
                    "access",
                    "aggregate_supply"
                  ]
                },
                "confirmed": {
                  "type": "boolean"
                },
                "confirmedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "confirmedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "item",
                "confirmed",
                "confirmedOn",
                "confirmedByName",
                "note"
              ],
              "additionalProperties": false
            },
            "description": "One entry per checklist item: pad, power, water, access, aggregate_supply"
          },
          "confirmedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "ready": {
            "type": "boolean",
            "description": "True when every item is confirmed"
          }
        },
        "required": [
          "siteId",
          "items",
          "confirmedCount",
          "totalCount",
          "ready"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.list",
      "toolName": "orders_list",
      "group": "orders",
      "title": "List orders",
      "description": "List production orders with filters for account, stage and validity. Each row says whether the order is valid and, if not, which of the three requirements are missing (signed quote, its received date, balance remaining).",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stages": {
            "description": "Several stages at once",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ]
            }
          },
          "open": {
            "description": "true for orders not yet closed, false for closed orders",
            "type": "boolean"
          },
          "valid": {
            "description": "false returns only orders that are not yet valid",
            "type": "boolean"
          },
          "query": {
            "description": "Matches order number, PO number, title or account name",
            "type": "string",
            "maxLength": 200
          },
          "sort": {
            "default": "newest",
            "type": "string",
            "enum": [
              "newest",
              "oldest",
              "order_number",
              "expected_ship"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Delivery site"
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "stageDates": {
                  "type": "object",
                  "properties": {
                    "received": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "in_build": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ready_to_ship": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "shipped": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivered": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "set_up": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "commissioned": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "trained": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "closed": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ],
                  "additionalProperties": false,
                  "description": "Date each stage was reached; null if not yet"
                },
                "signedQuoteDocumentId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signedQuoteReceivedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "balanceRemainingCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null until someone records it; 0 means paid in full"
                },
                "isValid": {
                  "type": "boolean"
                },
                "financingPartner": {
                  "type": "string",
                  "enum": [
                    "none",
                    "commercial_capital",
                    "northland_capital",
                    "other"
                  ]
                },
                "financingStatus": {
                  "type": "string",
                  "enum": [
                    "not_applicable",
                    "pending",
                    "approved",
                    "declined",
                    "funded"
                  ]
                },
                "financingNotes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "poNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expectedShipOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ownerUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "missing": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "signed_quote",
                      "signed_quote_received_on",
                      "balance_remaining"
                    ]
                  }
                },
                "nextStage": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "received",
                        "in_build",
                        "ready_to_ship",
                        "shipped",
                        "delivered",
                        "set_up",
                        "commissioned",
                        "trained",
                        "closed"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "machineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderNumber",
                "accountId",
                "siteId",
                "title",
                "stage",
                "stageDates",
                "signedQuoteDocumentId",
                "signedQuoteReceivedOn",
                "totalCents",
                "balanceRemainingCents",
                "isValid",
                "financingPartner",
                "financingStatus",
                "financingNotes",
                "poNumber",
                "expectedShipOn",
                "ownerUserId",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "missing",
                "nextStage",
                "lineCount",
                "machineCount"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.board",
      "toolName": "orders_board",
      "group": "orders",
      "title": "Get the order board by stage",
      "description": "Every order grouped into the nine lifecycle stages in order (received, in_build, ready_to_ship, shipped, delivered, set_up, commissioned, trained, closed), with a count and dollar total per stage. Orders that are not valid are flagged with what is missing. Closed orders are left out unless includeClosed is true.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "includeClosed": {
            "default": false,
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "orders": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "orderNumber": {
                        "type": "string"
                      },
                      "accountId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "siteId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Delivery site"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "stage": {
                        "type": "string",
                        "enum": [
                          "received",
                          "in_build",
                          "ready_to_ship",
                          "shipped",
                          "delivered",
                          "set_up",
                          "commissioned",
                          "trained",
                          "closed"
                        ]
                      },
                      "stageDates": {
                        "type": "object",
                        "properties": {
                          "received": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "in_build": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ready_to_ship": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "shipped": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "delivered": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "set_up": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "commissioned": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "trained": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closed": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                                "description": "Date as YYYY-MM-DD"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "received",
                          "in_build",
                          "ready_to_ship",
                          "shipped",
                          "delivered",
                          "set_up",
                          "commissioned",
                          "trained",
                          "closed"
                        ],
                        "additionalProperties": false,
                        "description": "Date each stage was reached; null if not yet"
                      },
                      "signedQuoteDocumentId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "signedQuoteReceivedOn": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "totalCents": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "description": "Amount in integer US cents (zero or more)"
                      },
                      "balanceRemainingCents": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991,
                            "description": "Amount in integer US cents (zero or more)"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Null until someone records it; 0 means paid in full"
                      },
                      "isValid": {
                        "type": "boolean"
                      },
                      "financingPartner": {
                        "type": "string",
                        "enum": [
                          "none",
                          "commercial_capital",
                          "northland_capital",
                          "other"
                        ]
                      },
                      "financingStatus": {
                        "type": "string",
                        "enum": [
                          "not_applicable",
                          "pending",
                          "approved",
                          "declined",
                          "funded"
                        ]
                      },
                      "financingNotes": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "poNumber": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "expectedShipOn": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ownerUserId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "notes": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      "accountName": {
                        "type": "string"
                      },
                      "siteName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "missing": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "signed_quote",
                            "signed_quote_received_on",
                            "balance_remaining"
                          ]
                        }
                      },
                      "nextStage": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "received",
                              "in_build",
                              "ready_to_ship",
                              "shipped",
                              "delivered",
                              "set_up",
                              "commissioned",
                              "trained",
                              "closed"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "lineCount": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "machineCount": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "id",
                      "orderNumber",
                      "accountId",
                      "siteId",
                      "title",
                      "stage",
                      "stageDates",
                      "signedQuoteDocumentId",
                      "signedQuoteReceivedOn",
                      "totalCents",
                      "balanceRemainingCents",
                      "isValid",
                      "financingPartner",
                      "financingStatus",
                      "financingNotes",
                      "poNumber",
                      "expectedShipOn",
                      "ownerUserId",
                      "notes",
                      "createdAt",
                      "updatedAt",
                      "accountName",
                      "siteName",
                      "missing",
                      "nextStage",
                      "lineCount",
                      "machineCount"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "stage",
                "label",
                "count",
                "totalCents",
                "orders"
              ],
              "additionalProperties": false
            },
            "description": "One column per stage, in lifecycle order"
          },
          "openCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "invalidCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Open orders that are not yet valid"
          }
        },
        "required": [
          "columns",
          "openCount",
          "invalidCount"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.get",
      "toolName": "orders_get",
      "group": "orders",
      "title": "Get an order",
      "description": "One order by id or order number: the valid-order checklist, the nine-stage timeline with dates and who moved it, balance remaining, financing, line items, linked documents, the machines built for it, and its account and site.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string",
            "maxLength": 40
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "siteName": {
            "type": [
              "string",
              "null"
            ]
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "signed_quote",
                "signed_quote_received_on",
                "balance_remaining"
              ]
            }
          },
          "nextStage": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "machineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "validity": {
            "type": "object",
            "properties": {
              "isValid": {
                "type": "boolean",
                "description": "True when the order has the signed quote, its received date and the balance remaining"
              },
              "missing": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "signed_quote_received_on",
                    "balance_remaining"
                  ]
                },
                "description": "Requirements still missing; empty when valid"
              },
              "missingLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Human-readable names of the missing requirements"
              }
            },
            "required": [
              "isValid",
              "missing",
              "missingLabels"
            ],
            "additionalProperties": false
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sku": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderId",
                "productId",
                "sku",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "position"
              ],
              "additionalProperties": false
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "fromStage": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "received",
                        "in_build",
                        "ready_to_ship",
                        "shipped",
                        "delivered",
                        "set_up",
                        "commissioned",
                        "trained",
                        "closed"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "toStage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "occurredOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actorUserId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "orderId",
                "fromStage",
                "toStage",
                "occurredOn",
                "note",
                "actorUserId",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "done",
                    "current",
                    "upcoming"
                  ]
                },
                "date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ownerName": {
                  "description": "Who moved the order into this stage",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "stage",
                "label",
                "state",
                "date",
                "ownerName"
              ],
              "additionalProperties": false
            },
            "description": "All nine stages in order with state and date"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "stored"
                  ],
                  "description": "pending until the file bytes are stored"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerVisible": {
                  "type": "boolean",
                  "description": "Whether the customer can open it in the portal"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "email",
                    "portal",
                    "system",
                    "import"
                  ]
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "parts_order",
                          "part",
                          "opportunity",
                          "check_in"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      }
                    },
                    "required": [
                      "entityType",
                      "entityId"
                    ],
                    "additionalProperties": false
                  }
                },
                "uploadedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "status",
                "accountId",
                "customerVisible",
                "source",
                "links",
                "uploadedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "machines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "normalizedName": {
                "type": "string",
                "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
              },
              "segment": {
                "type": "string",
                "enum": [
                  "concrete_producer",
                  "multiservice"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "prospect",
                  "inactive"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqState": {
                "description": "Two-letter US state or region code",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqPostalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCountry": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hubspotCompanyId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Staff user who owns the account"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastContactedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Most recent call, email, text or visit"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "name",
              "normalizedName",
              "segment",
              "status",
              "phone",
              "website",
              "hqLine1",
              "hqLine2",
              "hqCity",
              "hqState",
              "hqPostalCode",
              "hqCountry",
              "hubspotCompanyId",
              "ownerUserId",
              "notes",
              "lastContactedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "site": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "name": {
                    "type": "string"
                  },
                  "line1": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "line2": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "city": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "state": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postalCode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "latitude": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": -90,
                        "maximum": 90
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "longitude": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": -180,
                        "maximum": 180
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "powerSource": {
                    "description": "For example utility 480V three-phase, or generator",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "waterSource": {
                    "description": "For example municipal, well, hauled",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "activeFrom": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "activeTo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Set when the site is no longer used"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "accountId",
                  "name",
                  "line1",
                  "line2",
                  "city",
                  "state",
                  "postalCode",
                  "country",
                  "latitude",
                  "longitude",
                  "powerSource",
                  "waterSource",
                  "activeFrom",
                  "activeTo",
                  "notes",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "siteName",
          "missing",
          "nextStage",
          "lineCount",
          "machineCount",
          "validity",
          "lines",
          "events",
          "timeline",
          "documents",
          "machines",
          "account",
          "site"
        ],
        "additionalProperties": false
      },
      "view": "order"
    },
    {
      "name": "orders.create",
      "toolName": "orders_create",
      "group": "orders",
      "title": "Create a production order",
      "description": "Open a production order for an account at stage received. The order number is assigned automatically unless given. Lines can be added now or later. The order stays not valid, and cannot leave received, until it has the signed quote document, the date it was received and the balance remaining.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "description": "Delivery site",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "receivedOn": {
            "description": "Date the production order arrived; defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "poNumber": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "financingPartner": {
            "default": "none",
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "default": "not_applicable",
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "ownerUserId": {
            "description": "Defaults to the caller",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "productId": {
                  "description": "Product from the 2026.11 price list; fills sku, description and price when given",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "description": {
                  "description": "Required when there is no productId",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                },
                "quantity": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "description": "Overrides the list price",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              }
            }
          }
        },
        "required": [
          "accountId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sku": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderId",
                "productId",
                "sku",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "position"
              ],
              "additionalProperties": false
            }
          },
          "validity": {
            "type": "object",
            "properties": {
              "isValid": {
                "type": "boolean",
                "description": "True when the order has the signed quote, its received date and the balance remaining"
              },
              "missing": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "signed_quote_received_on",
                    "balance_remaining"
                  ]
                },
                "description": "Requirements still missing; empty when valid"
              },
              "missingLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Human-readable names of the missing requirements"
              }
            },
            "required": [
              "isValid",
              "missing",
              "missingLabels"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "order",
          "lines",
          "validity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.update",
      "toolName": "orders_update",
      "group": "orders",
      "title": "Update an order",
      "description": "Change order fields: delivery site, title, PO number, expected ship date, balance remaining, the signed-quote received date, owner or notes. Only the fields you send are changed. This does not change the stage (use orders.advance) or attach the signed quote file (use orders.attach_signed_quote). Returns the new validity.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "poNumber": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "balanceRemainingCents": {
            "description": "0 means paid in full; null clears it",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "stageDate": {
            "description": "Correct the date of a stage the order has already reached",
            "type": "object",
            "properties": {
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "date": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              }
            },
            "required": [
              "stage",
              "date"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "validity": {
            "type": "object",
            "properties": {
              "isValid": {
                "type": "boolean",
                "description": "True when the order has the signed quote, its received date and the balance remaining"
              },
              "missing": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "signed_quote_received_on",
                    "balance_remaining"
                  ]
                },
                "description": "Requirements still missing; empty when valid"
              },
              "missingLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Human-readable names of the missing requirements"
              }
            },
            "required": [
              "isValid",
              "missing",
              "missingLabels"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "order",
          "validity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.add_line",
      "toolName": "orders_add_line",
      "group": "orders",
      "title": "Add a line item to an order",
      "description": "Add one line to an order, normally a product from the 2026.11 equipment price list (give productId), or a free-text line with a description and unit price. The order total is recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "productId": {
            "description": "Product from the 2026.11 price list; fills sku, description and price when given",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": {
            "description": "Required when there is no productId",
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "quantity": {
            "default": 1,
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "description": "Overrides the list price",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "orderId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "line": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sku": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": "string"
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "unitPriceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "position": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "orderId",
              "productId",
              "sku",
              "description",
              "quantity",
              "unitPriceCents",
              "totalCents",
              "position"
            ],
            "additionalProperties": false
          },
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "line",
          "order"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.update_line",
      "toolName": "orders_update_line",
      "group": "orders",
      "title": "Change an order line",
      "description": "Change the quantity, unit price or description of an order line. The order total is recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "lineId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "line": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sku": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": "string"
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "unitPriceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "position": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "orderId",
              "productId",
              "sku",
              "description",
              "quantity",
              "unitPriceCents",
              "totalCents",
              "position"
            ],
            "additionalProperties": false
          },
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "line",
          "order"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.remove_line",
      "toolName": "orders_remove_line",
      "group": "orders",
      "title": "Remove an order line",
      "description": "Delete one line from an order and recalculate the total.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "lineId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "id",
          "order"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.attach_signed_quote",
      "toolName": "orders_attach_signed_quote",
      "group": "orders",
      "title": "Attach the signed quote to an order",
      "description": "Record the customer's signed quote on an order. Either point at a document already uploaded (documentId) or send the file inline (file). Sets the signed-quote received date (today unless receivedOn is given) and, optionally, the balance remaining, so one call can make the order valid. Returns the new validity.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "documentId": {
            "description": "An existing document to use as the signed quote",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "file": {
            "description": "Upload the signed quote in this call instead",
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "contentType": {
                "default": "application/pdf",
                "type": "string",
                "maxLength": 100
              },
              "contentBase64": {
                "type": "string",
                "minLength": 1,
                "description": "File bytes, base64 encoded (max 10 MB)"
              }
            },
            "required": [
              "filename",
              "contentBase64"
            ]
          },
          "receivedOn": {
            "description": "Date the signed quote was received; defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "balanceRemainingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          }
        },
        "required": [
          "orderId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "validity": {
            "type": "object",
            "properties": {
              "isValid": {
                "type": "boolean",
                "description": "True when the order has the signed quote, its received date and the balance remaining"
              },
              "missing": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "signed_quote_received_on",
                    "balance_remaining"
                  ]
                },
                "description": "Requirements still missing; empty when valid"
              },
              "missingLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Human-readable names of the missing requirements"
              }
            },
            "required": [
              "isValid",
              "missing",
              "missingLabels"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "order",
          "documentId",
          "validity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.advance",
      "toolName": "orders_advance",
      "group": "orders",
      "title": "Advance an order to the next stage",
      "description": "Move an order one step along the lifecycle: received, in_build, ready_to_ship, shipped, delivered, set_up, commissioned, trained, closed. An order cannot leave received until it is valid; otherwise the call fails with an invalid_order error whose details.missing lists what is needed. Each move writes an order event, emails the customer a status update and is audited. Moving to commissioned sets warranty start and end (12 months) on every machine of the order and creates the 30, 90 and 365-day check-ins. Pass toStage to state the stage you expect to reach; the call fails with a conflict if that is not the next stage.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "toStage": {
            "description": "Guard: must equal the next stage",
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "occurredOn": {
            "description": "Date the stage was reached; defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "notifyCustomer": {
            "default": true,
            "description": "Send the status email to the account's primary contact",
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "event": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "fromStage": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "received",
                      "in_build",
                      "ready_to_ship",
                      "shipped",
                      "delivered",
                      "set_up",
                      "commissioned",
                      "trained",
                      "closed"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "toStage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "occurredOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "actorUserId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "actorName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderId",
              "fromStage",
              "toStage",
              "occurredOn",
              "note",
              "actorUserId",
              "actorName",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "fromStage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "toStage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "machines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            },
            "description": "Machines whose status or warranty changed"
          },
          "checkIns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "day_30",
                    "day_90",
                    "day_365",
                    "pre_season",
                    "ad_hoc"
                  ]
                },
                "dueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "scheduled",
                    "completed",
                    "skipped"
                  ]
                },
                "completedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "outcome": {
                  "description": "What was learned on the call or visit",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taskId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Task that puts the check-in on the agenda and calendar"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "machineId",
                "orderId",
                "kind",
                "dueOn",
                "status",
                "completedOn",
                "outcome",
                "taskId",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            },
            "description": "Check-ins created (only when moving to commissioned)"
          },
          "emailQueued": {
            "type": "boolean"
          }
        },
        "required": [
          "order",
          "event",
          "fromStage",
          "toStage",
          "machines",
          "checkIns",
          "emailQueued"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.set_financing",
      "toolName": "orders_set_financing",
      "group": "orders",
      "title": "Set order financing",
      "description": "Record the lender for an order (Commercial Capital, Northland Capital, other, or none) and the approval status (pending, approved, declined, funded). There is no link to the lender's systems; this is a record only.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "financingPartner",
          "financingStatus"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Delivery site"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageDates": {
                "type": "object",
                "properties": {
                  "received": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "in_build": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ready_to_ship": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shipped": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "delivered": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "set_up": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissioned": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trained": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closed": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ],
                "additionalProperties": false,
                "description": "Date each stage was reached; null if not yet"
              },
              "signedQuoteDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signedQuoteReceivedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Null until someone records it; 0 means paid in full"
              },
              "isValid": {
                "type": "boolean"
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "financingNotes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ownerUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "siteId",
              "title",
              "stage",
              "stageDates",
              "signedQuoteDocumentId",
              "signedQuoteReceivedOn",
              "totalCents",
              "balanceRemainingCents",
              "isValid",
              "financingPartner",
              "financingStatus",
              "financingNotes",
              "poNumber",
              "expectedShipOn",
              "ownerUserId",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "order"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.export",
      "toolName": "orders_export",
      "group": "orders",
      "title": "Export an order",
      "description": "Produce one order as a file: json (all fields), csv (line items) or html (a printable order summary with the timeline). The content is returned as text.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "format": {
            "default": "html",
            "type": "string",
            "enum": [
              "json",
              "csv",
              "html"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "The exported file as text (JSON, CSV or printable HTML)"
          }
        },
        "required": [
          "filename",
          "contentType",
          "content"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "orders.add_document",
      "toolName": "orders_add_document",
      "group": "orders",
      "title": "Attach a document to an order",
      "description": "Link an existing document (purchase order, drawing, inspection report, photo) to an order, or upload one inline. For the signed quote use orders.attach_signed_quote instead.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "file": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "contentType": {
                "default": "application/pdf",
                "type": "string",
                "maxLength": 100
              },
              "contentBase64": {
                "type": "string",
                "minLength": 1,
                "description": "File bytes, base64 encoded (max 10 MB)"
              }
            },
            "required": [
              "filename",
              "contentBase64"
            ]
          },
          "kind": {
            "default": "other",
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          },
          "customerVisible": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "orderId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "documentId"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "products.list",
      "toolName": "products_list",
      "group": "products",
      "title": "List the equipment price list",
      "description": "The equipment products that can go on an order: Model 300 plant configurations, the central mixer, accessories (auxiliary silos, feeder belts) and options, with SKU and price from the 2026.11 price list.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "accessory",
              "option"
            ]
          },
          "query": {
            "description": "Matches SKU, name or description",
            "type": "string",
            "maxLength": 200
          },
          "activeOnly": {
            "default": true,
            "type": "boolean"
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "sku": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "accessory",
                    "option"
                  ]
                },
                "model": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "machineType": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "plant",
                        "mixer",
                        "silo",
                        "feeder",
                        "power_pack"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Machine type built when this product is ordered; null for options"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceList": {
                  "type": "string",
                  "description": "Price list the price comes from, for example 2026.11"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "sku",
                "name",
                "category",
                "model",
                "machineType",
                "description",
                "priceCents",
                "priceList",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "products.get",
      "toolName": "products_get",
      "group": "products",
      "title": "Get a product",
      "description": "Read one product from the equipment price list by id or SKU, with its category, model and list price.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "sku": {
            "type": "string",
            "maxLength": 60
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "sku": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "accessory",
              "option"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "machineType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine type built when this product is ordered; null for options"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "priceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "priceList": {
            "type": "string",
            "description": "Price list the price comes from, for example 2026.11"
          },
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          }
        },
        "required": [
          "id",
          "sku",
          "name",
          "category",
          "model",
          "machineType",
          "description",
          "priceCents",
          "priceList",
          "active",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "products.upsert",
      "toolName": "products_upsert",
      "group": "products",
      "title": "Create or update a product",
      "description": "Add a product to the equipment price list or change an existing one (matched by id, else by SKU). SKUs are unique. Existing order lines keep the price they were created with.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "sku": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "category": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "accessory",
              "option"
            ]
          },
          "model": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "machineType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "priceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "priceList": {
            "default": "2026.11",
            "type": "string",
            "maxLength": 20
          },
          "active": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "sku",
          "name",
          "category",
          "priceCents"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "product": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "sku": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "category": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "accessory",
                  "option"
                ]
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "machineType": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "plant",
                      "mixer",
                      "silo",
                      "feeder",
                      "power_pack"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Machine type built when this product is ordered; null for options"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceList": {
                "type": "string",
                "description": "Price list the price comes from, for example 2026.11"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "sku",
              "name",
              "category",
              "model",
              "machineType",
              "description",
              "priceCents",
              "priceList",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "product",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.list",
      "toolName": "machines_list",
      "group": "machines",
      "title": "List the installed base",
      "description": "Every plant, mixer, silo, feeder belt and power pack Cemco has built, as a table. Filter by owner, site, state, model, type, status and warranty state. Each row carries the owner and site names, the warranty state and days left, and the count of open tickets.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "description": "Owner",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "state": {
            "description": "State of the current site, for example TX",
            "type": "string",
            "maxLength": 40
          },
          "model": {
            "type": "string",
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_build",
              "in_transit",
              "operating",
              "down",
              "idle",
              "retired"
            ]
          },
          "warranty": {
            "description": "none, active, expiring (ends within 60 days) or expired",
            "type": "string",
            "enum": [
              "none",
              "active",
              "expiring",
              "expired"
            ]
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "query": {
            "description": "Matches serial number, model, configuration or owner name",
            "type": "string",
            "maxLength": 200
          },
          "sort": {
            "default": "serial",
            "type": "string",
            "enum": [
              "serial",
              "owner",
              "warranty_end",
              "newest"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "longitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "siteCity",
                "siteState",
                "latitude",
                "longitude",
                "openTicketCount"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "view": "installed-base"
    },
    {
      "name": "machines.map",
      "toolName": "machines_map",
      "group": "machines",
      "title": "Get installed-base map points",
      "description": "Machines as map points (latitude and longitude of their current site), with the same filters as machines.list. Machines whose site has no coordinates are counted in unmapped and left off.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "description": "Owner",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "state": {
            "description": "State of the current site, for example TX",
            "type": "string",
            "maxLength": 40
          },
          "model": {
            "type": "string",
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_build",
              "in_transit",
              "operating",
              "down",
              "idle",
              "retired"
            ]
          },
          "warranty": {
            "description": "none, active, expiring (ends within 60 days) or expired",
            "type": "string",
            "enum": [
              "none",
              "active",
              "expiring",
              "expired"
            ]
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "query": {
            "description": "Matches serial number, model, configuration or owner name",
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ]
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "siteId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "siteName": {
                  "type": "string"
                },
                "city": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "state": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": "number"
                },
                "longitude": {
                  "type": "number"
                }
              },
              "required": [
                "machineId",
                "serialNumber",
                "model",
                "type",
                "status",
                "warrantyState",
                "accountId",
                "accountName",
                "siteId",
                "siteName",
                "city",
                "state",
                "latitude",
                "longitude"
              ],
              "additionalProperties": false
            }
          },
          "unmapped": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "points",
          "unmapped"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.get",
      "toolName": "machines_get",
      "group": "machines",
      "title": "Get a machine",
      "description": "One machine by id or serial number with its full history: site moves, owners, service plans and contracts, commissioning and training records, check-ins, tickets, warranty claims and documents.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string",
            "maxLength": 60
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          },
          "model": {
            "type": "string"
          },
          "configuration": {
            "type": [
              "string",
              "null"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Current owner"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Current site"
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Order the machine was built for"
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_build",
              "in_transit",
              "operating",
              "down",
              "idle",
              "retired"
            ]
          },
          "builtOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyStart": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyState": {
            "type": "string",
            "enum": [
              "none",
              "active",
              "expiring",
              "expired"
            ],
            "description": "Computed from the warranty dates and today's date"
          },
          "warrantyDaysLeft": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "Days until the warranty ends; negative once expired; null if not started"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "siteName": {
            "type": [
              "string",
              "null"
            ]
          },
          "siteCity": {
            "type": [
              "string",
              "null"
            ]
          },
          "siteState": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "openTicketCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "locations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "siteId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "siteName": {
                  "type": "string"
                },
                "movedInOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "movedOutOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "machineId",
                "siteId",
                "siteName",
                "movedInOn",
                "movedOutOn",
                "note"
              ],
              "additionalProperties": false
            }
          },
          "owners": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "fromDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "toDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "machineId",
                "accountId",
                "accountName",
                "fromDate",
                "toDate",
                "note"
              ],
              "additionalProperties": false
            }
          },
          "servicePlans": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string",
                  "description": "For example Gearbox oil change"
                },
                "intervalDays": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "lastDoneOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "nextDueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "recommendedPartIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "description": "Spare parts normally used for this service"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "machineId",
                "name",
                "intervalDays",
                "lastDoneOn",
                "nextDueOn",
                "recommendedPartIds",
                "notes",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "serviceContracts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "planName": {
                  "type": "string"
                },
                "startsOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "renewsOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "expired",
                    "cancelled"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "machineId",
                "accountId",
                "planName",
                "startsOn",
                "renewsOn",
                "priceCents",
                "status",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "trainingRecords": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "setUpOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "firstBatchOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "trainedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "trainerName": {
                  "type": "string"
                },
                "trainees": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "role": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "contactId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "topics": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "punchList": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "item": {
                        "type": "string",
                        "minLength": 1
                      },
                      "done": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "item",
                      "done"
                    ],
                    "additionalProperties": false
                  }
                },
                "customerSignoffName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customerSignedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signoffDocumentId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "machineId",
                "orderId",
                "setUpOn",
                "firstBatchOn",
                "trainedOn",
                "trainerName",
                "trainees",
                "topics",
                "punchList",
                "customerSignoffName",
                "customerSignedOn",
                "signoffDocumentId",
                "notes",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "checkIns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "day_30",
                    "day_90",
                    "day_365",
                    "pre_season",
                    "ad_hoc"
                  ]
                },
                "dueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "scheduled",
                    "completed",
                    "skipped"
                  ]
                },
                "completedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "outcome": {
                  "description": "What was learned on the call or visit",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taskId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Task that puts the check-in on the agenda and calendar"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "machineId",
                "orderId",
                "kind",
                "dueOn",
                "status",
                "completedOn",
                "outcome",
                "taskId",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "tickets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "mechanical",
                    "electrical",
                    "controls",
                    "hydraulic",
                    "pneumatic",
                    "structural",
                    "calibration",
                    "operator_training",
                    "other"
                  ]
                },
                "priority": {
                  "type": "string",
                  "enum": [
                    "low",
                    "normal",
                    "high",
                    "down"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "new",
                    "diagnosing",
                    "parts_on_order",
                    "scheduled",
                    "waiting_on_customer",
                    "resolved",
                    "follow_up_complete"
                  ]
                },
                "rootCause": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "component_failure",
                        "manufacturing_defect",
                        "wear",
                        "operator_error",
                        "installation",
                        "shipping_damage",
                        "environment",
                        "design",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolution": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "staff",
                    "portal",
                    "email",
                    "agent"
                  ]
                },
                "assignedToUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isWarranty": {
                  "type": "boolean",
                  "description": "Whether the work is covered by warranty"
                },
                "onsiteHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total on-site hours logged"
                },
                "travelHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel hours logged"
                },
                "travelMiles": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel miles logged"
                },
                "openedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "scheduledFor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolvedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "machineModel": {
                  "type": "string"
                },
                "assignedToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "ticketNumber",
                "accountId",
                "machineId",
                "contactId",
                "title",
                "description",
                "category",
                "priority",
                "status",
                "rootCause",
                "resolution",
                "source",
                "assignedToUserId",
                "isWarranty",
                "onsiteHours",
                "travelHours",
                "travelMiles",
                "openedAt",
                "scheduledFor",
                "resolvedAt",
                "createdAt",
                "updatedAt",
                "accountName",
                "machineSerialNumber",
                "machineModel",
                "assignedToName"
              ],
              "additionalProperties": false
            }
          },
          "warrantyClaims": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "claimNumber": {
                  "type": "string"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "submitted",
                    "approved",
                    "denied",
                    "credited"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountClaimedCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "creditCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Credit granted to the customer"
                },
                "submittedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "decidedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "claimNumber",
                "ticketId",
                "machineId",
                "accountId",
                "status",
                "description",
                "amountClaimedCents",
                "creditCents",
                "submittedOn",
                "decidedOn",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "stored"
                  ],
                  "description": "pending until the file bytes are stored"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerVisible": {
                  "type": "boolean",
                  "description": "Whether the customer can open it in the portal"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "email",
                    "portal",
                    "system",
                    "import"
                  ]
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "parts_order",
                          "part",
                          "opportunity",
                          "check_in"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      }
                    },
                    "required": [
                      "entityType",
                      "entityId"
                    ],
                    "additionalProperties": false
                  }
                },
                "uploadedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "status",
                "accountId",
                "customerVisible",
                "source",
                "links",
                "uploadedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "serialNumber",
          "type",
          "model",
          "configuration",
          "options",
          "accountId",
          "siteId",
          "orderId",
          "productId",
          "status",
          "builtOn",
          "shippedOn",
          "commissionedOn",
          "warrantyStart",
          "warrantyEnd",
          "warrantyState",
          "warrantyDaysLeft",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "siteName",
          "siteCity",
          "siteState",
          "latitude",
          "longitude",
          "openTicketCount",
          "locations",
          "owners",
          "servicePlans",
          "serviceContracts",
          "trainingRecords",
          "checkIns",
          "tickets",
          "warrantyClaims",
          "documents"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.lookup_serial",
      "toolName": "machines_lookup_serial",
      "group": "machines",
      "title": "Find a machine by serial number",
      "description": "Field lookup: find machines from a full or partial serial number as read off the nameplate. Case, spaces and dashes are ignored. Returns the closest matches, exact match first.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "serial": {
            "type": "string",
            "minLength": 2,
            "maxLength": 60,
            "description": "Serial number or part of it"
          },
          "limit": {
            "default": 10,
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          }
        },
        "required": [
          "serial"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "exact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "serialNumber": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "plant",
                      "mixer",
                      "silo",
                      "feeder",
                      "power_pack"
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "configuration": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Current owner"
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Current site"
                  },
                  "orderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Order the machine was built for"
                  },
                  "productId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_build",
                      "in_transit",
                      "operating",
                      "down",
                      "idle",
                      "retired"
                    ]
                  },
                  "builtOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shippedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissionedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyStart": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyState": {
                    "type": "string",
                    "enum": [
                      "none",
                      "active",
                      "expiring",
                      "expired"
                    ],
                    "description": "Computed from the warranty dates and today's date"
                  },
                  "warrantyDaysLeft": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Days until the warranty ends; negative once expired; null if not started"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "accountName": {
                    "type": "string"
                  },
                  "siteName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "siteCity": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "siteState": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "latitude": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "longitude": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "openTicketCount": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "id",
                  "serialNumber",
                  "type",
                  "model",
                  "configuration",
                  "options",
                  "accountId",
                  "siteId",
                  "orderId",
                  "productId",
                  "status",
                  "builtOn",
                  "shippedOn",
                  "commissionedOn",
                  "warrantyStart",
                  "warrantyEnd",
                  "warrantyState",
                  "warrantyDaysLeft",
                  "notes",
                  "createdAt",
                  "updatedAt",
                  "accountName",
                  "siteName",
                  "siteCity",
                  "siteState",
                  "latitude",
                  "longitude",
                  "openTicketCount"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "longitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "siteCity",
                "siteState",
                "latitude",
                "longitude",
                "openTicketCount"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "exact",
          "matches"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.identify_nameplate",
      "toolName": "machines_identify_nameplate",
      "group": "machines",
      "title": "Find a machine from a nameplate photo",
      "description": "Field lookup from a photo: reads the serial number off a nameplate photo and looks the machine up. Returns the text that was read, candidate serial numbers and matching machines. available is false when no vision model is configured; in that case read the serial yourself and call machines.lookup_serial.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "imageBase64": {
            "type": "string",
            "minLength": 1,
            "maxLength": 7200000,
            "description": "JPEG, PNG or WebP photo of the nameplate, base64 encoded, at most 5 MB once decoded"
          },
          "contentType": {
            "default": "image/jpeg",
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp"
            ]
          }
        },
        "required": [
          "imageBase64"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean"
          },
          "text": {
            "description": "Text read from the nameplate",
            "type": [
              "string",
              "null"
            ]
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Serial numbers found in the text"
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "longitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "siteCity",
                "siteState",
                "latitude",
                "longitude",
                "openTicketCount"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "available",
          "text",
          "candidates",
          "matches"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.register",
      "toolName": "machines_register",
      "group": "machines",
      "title": "Register a machine",
      "description": "Add a machine to the installed base with its unique serial number, type, model, configuration and options, owner and (optionally) the order it was built for and its current site. Fails with a conflict if the serial number already exists. Warranty dates are normally left empty; they are set when the order is commissioned.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "serialNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "configuration": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "options": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Owner"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "default": "in_build",
            "type": "string",
            "enum": [
              "in_build",
              "in_transit",
              "operating",
              "down",
              "idle",
              "retired"
            ]
          },
          "builtOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyStart": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "serialNumber",
          "type",
          "model",
          "accountId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machine": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "serialNumber": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              "model": {
                "type": "string"
              },
              "configuration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Current owner"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current site"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Order the machine was built for"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "in_build",
                  "in_transit",
                  "operating",
                  "down",
                  "idle",
                  "retired"
                ]
              },
              "builtOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissionedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyStart": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyEnd": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyState": {
                "type": "string",
                "enum": [
                  "none",
                  "active",
                  "expiring",
                  "expired"
                ],
                "description": "Computed from the warranty dates and today's date"
              },
              "warrantyDaysLeft": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Days until the warranty ends; negative once expired; null if not started"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "serialNumber",
              "type",
              "model",
              "configuration",
              "options",
              "accountId",
              "siteId",
              "orderId",
              "productId",
              "status",
              "builtOn",
              "shippedOn",
              "commissionedOn",
              "warrantyStart",
              "warrantyEnd",
              "warrantyState",
              "warrantyDaysLeft",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "machine"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.update",
      "toolName": "machines_update",
      "group": "machines",
      "title": "Update a machine",
      "description": "Change a machine's model, configuration, options, status, dates, warranty dates or notes. Only the fields you send are changed. To move it to another site use machines.move_site; to change the owner use machines.change_owner.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "configuration": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_build",
              "in_transit",
              "operating",
              "down",
              "idle",
              "retired"
            ]
          },
          "builtOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyStart": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machine": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "serialNumber": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              "model": {
                "type": "string"
              },
              "configuration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Current owner"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current site"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Order the machine was built for"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "in_build",
                  "in_transit",
                  "operating",
                  "down",
                  "idle",
                  "retired"
                ]
              },
              "builtOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissionedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyStart": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyEnd": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyState": {
                "type": "string",
                "enum": [
                  "none",
                  "active",
                  "expiring",
                  "expired"
                ],
                "description": "Computed from the warranty dates and today's date"
              },
              "warrantyDaysLeft": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Days until the warranty ends; negative once expired; null if not started"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "serialNumber",
              "type",
              "model",
              "configuration",
              "options",
              "accountId",
              "siteId",
              "orderId",
              "productId",
              "status",
              "builtOn",
              "shippedOn",
              "commissionedOn",
              "warrantyStart",
              "warrantyEnd",
              "warrantyState",
              "warrantyDaysLeft",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "machine"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.move_site",
      "toolName": "machines_move_site",
      "group": "machines",
      "title": "Move a machine to another site",
      "description": "Record that a machine moved to a different job site. Closes the current location row with the move date and opens a new one, so the machine keeps its full location history. The site must belong to the machine's owner.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "movedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "machineId",
          "siteId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machine": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "serialNumber": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              "model": {
                "type": "string"
              },
              "configuration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Current owner"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current site"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Order the machine was built for"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "in_build",
                  "in_transit",
                  "operating",
                  "down",
                  "idle",
                  "retired"
                ]
              },
              "builtOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissionedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyStart": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyEnd": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyState": {
                "type": "string",
                "enum": [
                  "none",
                  "active",
                  "expiring",
                  "expired"
                ],
                "description": "Computed from the warranty dates and today's date"
              },
              "warrantyDaysLeft": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Days until the warranty ends; negative once expired; null if not started"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "serialNumber",
              "type",
              "model",
              "configuration",
              "options",
              "accountId",
              "siteId",
              "orderId",
              "productId",
              "status",
              "builtOn",
              "shippedOn",
              "commissionedOn",
              "warrantyStart",
              "warrantyEnd",
              "warrantyState",
              "warrantyDaysLeft",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "siteName": {
                "type": "string"
              },
              "movedInOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "movedOutOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "machineId",
              "siteId",
              "siteName",
              "movedInOn",
              "movedOutOn",
              "note"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "machine",
          "location"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.change_owner",
      "toolName": "machines_change_owner",
      "group": "machines",
      "title": "Change a machine's owner",
      "description": "Record a resale or transfer: the machine now belongs to another account. Closes the current owner row and opens a new one. Optionally moves the machine to one of the new owner's sites in the same call. Warranty dates are kept.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "New owner"
          },
          "siteId": {
            "description": "New owner's site; omit to leave the machine without a site",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "changedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "machineId",
          "accountId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machine": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "serialNumber": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              "model": {
                "type": "string"
              },
              "configuration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Current owner"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current site"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Order the machine was built for"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "in_build",
                  "in_transit",
                  "operating",
                  "down",
                  "idle",
                  "retired"
                ]
              },
              "builtOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissionedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyStart": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyEnd": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyState": {
                "type": "string",
                "enum": [
                  "none",
                  "active",
                  "expiring",
                  "expired"
                ],
                "description": "Computed from the warranty dates and today's date"
              },
              "warrantyDaysLeft": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Days until the warranty ends; negative once expired; null if not started"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "serialNumber",
              "type",
              "model",
              "configuration",
              "options",
              "accountId",
              "siteId",
              "orderId",
              "productId",
              "status",
              "builtOn",
              "shippedOn",
              "commissionedOn",
              "warrantyStart",
              "warrantyEnd",
              "warrantyState",
              "warrantyDaysLeft",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "owner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "fromDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "toDate": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "machineId",
              "accountId",
              "accountName",
              "fromDate",
              "toDate",
              "note"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "machine",
          "owner"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.warranty_status",
      "toolName": "machines_warranty_status",
      "group": "machines",
      "title": "Check warranty status",
      "description": "Warranty coverage for one machine (by id or serial number): start and end dates, state (none, active, expiring, expired), days left, and any warranty claims made against it.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string",
            "maxLength": 60
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountName": {
            "type": "string"
          },
          "warrantyStart": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "warrantyEnd": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "none",
              "active",
              "expiring",
              "expired"
            ]
          },
          "daysLeft": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "covered": {
            "type": "boolean",
            "description": "True while the warranty is active or expiring"
          },
          "claims": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "claimNumber": {
                  "type": "string"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "submitted",
                    "approved",
                    "denied",
                    "credited"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountClaimedCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "creditCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Credit granted to the customer"
                },
                "submittedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "decidedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "claimNumber",
                "ticketId",
                "machineId",
                "accountId",
                "status",
                "description",
                "amountClaimedCents",
                "creditCents",
                "submittedOn",
                "decidedOn",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "machineId",
          "serialNumber",
          "model",
          "accountId",
          "accountName",
          "warrantyStart",
          "warrantyEnd",
          "state",
          "daysLeft",
          "covered",
          "claims"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.add_training_record",
      "toolName": "machines_add_training_record",
      "group": "machines",
      "title": "Record commissioning and training",
      "description": "Save the commissioning and training record for a machine: set-up date, first batch date, training date, trainer, who was trained, topics covered, the punch list and the customer's sign-off.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "setUpOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "firstBatchOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "trainedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "trainerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trainees": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "role": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "name"
              ]
            }
          },
          "topics": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "punchList": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "minLength": 1
                },
                "done": {
                  "type": "boolean"
                }
              },
              "required": [
                "item",
                "done"
              ]
            }
          },
          "customerSignoffName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "customerSignedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "signoffDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "machineId",
          "trainedOn",
          "trainerName",
          "trainees"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "record": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "setUpOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "firstBatchOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trainedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "trainerName": {
                "type": "string"
              },
              "trainees": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "role": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "additionalProperties": false
                }
              },
              "topics": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "punchList": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "item": {
                      "type": "string",
                      "minLength": 1
                    },
                    "done": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "item",
                    "done"
                  ],
                  "additionalProperties": false
                }
              },
              "customerSignoffName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerSignedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signoffDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "machineId",
              "orderId",
              "setUpOn",
              "firstBatchOn",
              "trainedOn",
              "trainerName",
              "trainees",
              "topics",
              "punchList",
              "customerSignoffName",
              "customerSignedOn",
              "signoffDocumentId",
              "notes",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "record"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.update_training_record",
      "toolName": "machines_update_training_record",
      "group": "machines",
      "title": "Update a commissioning and training record",
      "description": "Change a training record, for example to tick off punch-list items or add the customer's sign-off.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "setUpOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "firstBatchOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "trainedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "trainerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "trainees": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "role": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "name"
              ]
            }
          },
          "topics": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "punchList": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "minLength": 1
                },
                "done": {
                  "type": "boolean"
                }
              },
              "required": [
                "item",
                "done"
              ]
            }
          },
          "customerSignoffName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "customerSignedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "signoffDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "record": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "setUpOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "firstBatchOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trainedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "trainerName": {
                "type": "string"
              },
              "trainees": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "role": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "additionalProperties": false
                }
              },
              "topics": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "punchList": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "item": {
                      "type": "string",
                      "minLength": 1
                    },
                    "done": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "item",
                    "done"
                  ],
                  "additionalProperties": false
                }
              },
              "customerSignoffName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerSignedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signoffDocumentId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "machineId",
              "orderId",
              "setUpOn",
              "firstBatchOn",
              "trainedOn",
              "trainerName",
              "trainees",
              "topics",
              "punchList",
              "customerSignoffName",
              "customerSignedOn",
              "signoffDocumentId",
              "notes",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "record"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.list_training_records",
      "toolName": "machines_list_training_records",
      "group": "machines",
      "title": "List commissioning and training records",
      "description": "Commissioning and training records for one machine or for every machine of an order, newest first.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "setUpOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "firstBatchOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "trainedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "trainerName": {
                  "type": "string"
                },
                "trainees": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "role": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "contactId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "topics": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "punchList": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "item": {
                        "type": "string",
                        "minLength": 1
                      },
                      "done": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "item",
                      "done"
                    ],
                    "additionalProperties": false
                  }
                },
                "customerSignoffName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customerSignedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signoffDocumentId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "machineId",
                "orderId",
                "setUpOn",
                "firstBatchOn",
                "trainedOn",
                "trainerName",
                "trainees",
                "topics",
                "punchList",
                "customerSignoffName",
                "customerSignedOn",
                "signoffDocumentId",
                "notes",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.upsert_service_plan",
      "toolName": "machines_upsert_service_plan",
      "group": "machines",
      "title": "Create or update a preventive maintenance plan",
      "description": "Set a recurring service for a machine (for example gearbox oil every 180 days) with the spare parts normally used. Give id to change an existing plan. The next due date is last done plus the interval unless given.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "intervalDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          },
          "lastDoneOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextDueOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "recommendedPartIds": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "active": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "machineId",
          "name",
          "intervalDays"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string",
                "description": "For example Gearbox oil change"
              },
              "intervalDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "lastDoneOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "nextDueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "recommendedPartIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "description": "Spare parts normally used for this service"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "machineId",
              "name",
              "intervalDays",
              "lastDoneOn",
              "nextDueOn",
              "recommendedPartIds",
              "notes",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "plan",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.complete_service",
      "toolName": "machines_complete_service",
      "group": "machines",
      "title": "Mark preventive maintenance done",
      "description": "Record that a service plan was carried out on a date. Sets last done, moves the next due date forward by the interval and creates the reminder task for the next one.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "planId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "doneOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "planId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string",
                "description": "For example Gearbox oil change"
              },
              "intervalDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "lastDoneOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "nextDueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "recommendedPartIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "description": "Spare parts normally used for this service"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "machineId",
              "name",
              "intervalDays",
              "lastDoneOn",
              "nextDueOn",
              "recommendedPartIds",
              "notes",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "reminderTask": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "task",
                      "call",
                      "visit",
                      "delivery",
                      "commissioning",
                      "service",
                      "check_in"
                    ]
                  },
                  "title": {
                    "type": "string"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "done",
                      "cancelled"
                    ]
                  },
                  "dueOn": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Day the task is due or the appointment happens"
                  },
                  "startsAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Start time for timed appointments; null for all-day items"
                  },
                  "endsAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "location": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "assignedToUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assignedToName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "accountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "accountName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "contactId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "orderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "machineId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ticketId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "checkInId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "isOverdue": {
                    "type": "boolean",
                    "description": "Open and due before today"
                  },
                  "googleEventId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "syncState": {
                    "type": "string",
                    "enum": [
                      "not_synced",
                      "pending",
                      "synced",
                      "error"
                    ]
                  },
                  "syncedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "syncError": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "completedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "title",
                  "notes",
                  "status",
                  "dueOn",
                  "startsAt",
                  "endsAt",
                  "location",
                  "assignedToUserId",
                  "assignedToName",
                  "accountId",
                  "accountName",
                  "contactId",
                  "orderId",
                  "machineId",
                  "ticketId",
                  "siteId",
                  "checkInId",
                  "isOverdue",
                  "googleEventId",
                  "syncState",
                  "syncedAt",
                  "syncError",
                  "completedAt",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "plan",
          "reminderTask"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.list_service_plans",
      "toolName": "machines_list_service_plans",
      "group": "machines",
      "title": "List preventive maintenance plans",
      "description": "Service plans for one machine, one account, or everything due within a number of days. Each plan has its interval, last done and next due dates and recommended spare parts.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "dueWithinDays": {
            "description": "Only plans due within this many days (overdue included)",
            "type": "integer",
            "minimum": 0,
            "maximum": 3650
          },
          "activeOnly": {
            "default": true,
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string",
                  "description": "For example Gearbox oil change"
                },
                "intervalDays": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "lastDoneOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "nextDueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "recommendedPartIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "description": "Spare parts normally used for this service"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "accountName": {
                  "type": "string"
                },
                "overdue": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "machineId",
                "name",
                "intervalDays",
                "lastDoneOn",
                "nextDueOn",
                "recommendedPartIds",
                "notes",
                "active",
                "createdAt",
                "updatedAt",
                "machineSerialNumber",
                "accountName",
                "overdue"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.upsert_service_contract",
      "toolName": "machines_upsert_service_contract",
      "group": "machines",
      "title": "Create or update a service contract",
      "description": "Record a service contract on a machine: plan name, start date, renewal date, price and status. Give id to change an existing contract. Renewal dates appear on the agenda.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "planName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "startsOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "renewsOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "priceCents": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "status": {
            "default": "active",
            "type": "string",
            "enum": [
              "active",
              "expired",
              "cancelled"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "machineId",
          "planName",
          "startsOn",
          "renewsOn"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "contract": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "planName": {
                "type": "string"
              },
              "startsOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "renewsOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "expired",
                  "cancelled"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "machineId",
              "accountId",
              "planName",
              "startsOn",
              "renewsOn",
              "priceCents",
              "status",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "contract",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "machines.list_service_contracts",
      "toolName": "machines_list_service_contracts",
      "group": "machines",
      "title": "List service contracts",
      "description": "Service contracts for one machine, one account, or all contracts renewing within a number of days.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "cancelled"
            ]
          },
          "renewingWithinDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3650
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "planName": {
                  "type": "string"
                },
                "startsOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "renewsOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "expired",
                    "cancelled"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "accountName": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "machineId",
                "accountId",
                "planName",
                "startsOn",
                "renewsOn",
                "priceCents",
                "status",
                "notes",
                "createdAt",
                "updatedAt",
                "machineSerialNumber",
                "accountName"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "checkins.list",
      "toolName": "checkins_list",
      "group": "checkins",
      "title": "List check-ins",
      "description": "Customer check-ins: the 30, 90 and 365-day follow-ups created at commissioning, pre-season calls and ad-hoc check-ins. Filter by account, machine, status or due-date range.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "completed",
              "skipped"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "day_30",
              "day_90",
              "day_365",
              "pre_season",
              "ad_hoc"
            ]
          },
          "dueFrom": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "dueTo": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "day_30",
                    "day_90",
                    "day_365",
                    "pre_season",
                    "ad_hoc"
                  ]
                },
                "dueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "scheduled",
                    "completed",
                    "skipped"
                  ]
                },
                "completedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "outcome": {
                  "description": "What was learned on the call or visit",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taskId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Task that puts the check-in on the agenda and calendar"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "machineSerialNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "overdue": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "accountId",
                "machineId",
                "orderId",
                "kind",
                "dueOn",
                "status",
                "completedOn",
                "outcome",
                "taskId",
                "createdAt",
                "updatedAt",
                "accountName",
                "machineSerialNumber",
                "overdue"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "checkins.schedule",
      "toolName": "checkins_schedule",
      "group": "checkins",
      "title": "Schedule a check-in",
      "description": "Schedule a check-in with a customer, typically a pre-season call or an extra follow-up. Creates the matching task so it shows on the agenda and calendar. The 30, 90 and 365-day check-ins are created automatically at commissioning.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "default": "pre_season",
            "type": "string",
            "enum": [
              "day_30",
              "day_90",
              "day_365",
              "pre_season",
              "ad_hoc"
            ]
          },
          "dueOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "assignedToUserId": {
            "description": "Defaults to the caller",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accountId",
          "dueOn"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "checkIn": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "day_30",
                  "day_90",
                  "day_365",
                  "pre_season",
                  "ad_hoc"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "status": {
                "type": "string",
                "enum": [
                  "scheduled",
                  "completed",
                  "skipped"
                ]
              },
              "completedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outcome": {
                "description": "What was learned on the call or visit",
                "type": [
                  "string",
                  "null"
                ]
              },
              "taskId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Task that puts the check-in on the agenda and calendar"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "machineId",
              "orderId",
              "kind",
              "dueOn",
              "status",
              "completedOn",
              "outcome",
              "taskId",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "checkIn"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "checkins.update",
      "toolName": "checkins_update",
      "group": "checkins",
      "title": "Reschedule or skip a check-in",
      "description": "Move a scheduled check-in to another date, or mark it skipped. The linked task follows.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "dueOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "skipped"
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "checkIn": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "day_30",
                  "day_90",
                  "day_365",
                  "pre_season",
                  "ad_hoc"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "status": {
                "type": "string",
                "enum": [
                  "scheduled",
                  "completed",
                  "skipped"
                ]
              },
              "completedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outcome": {
                "description": "What was learned on the call or visit",
                "type": [
                  "string",
                  "null"
                ]
              },
              "taskId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Task that puts the check-in on the agenda and calendar"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "machineId",
              "orderId",
              "kind",
              "dueOn",
              "status",
              "completedOn",
              "outcome",
              "taskId",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "checkIn"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "checkins.complete",
      "toolName": "checkins_complete",
      "group": "checkins",
      "title": "Complete a check-in",
      "description": "Mark a check-in done with what was learned. Completes the linked task and logs a call or visit on the account timeline so the account counts as contacted.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "completedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "outcome": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000,
            "description": "What the customer said; any issues or add-on interest"
          },
          "activityType": {
            "default": "call",
            "type": "string",
            "enum": [
              "call",
              "visit",
              "email",
              "text"
            ]
          }
        },
        "required": [
          "id",
          "outcome"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "checkIn": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "day_30",
                  "day_90",
                  "day_365",
                  "pre_season",
                  "ad_hoc"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "status": {
                "type": "string",
                "enum": [
                  "scheduled",
                  "completed",
                  "skipped"
                ]
              },
              "completedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outcome": {
                "description": "What was learned on the call or visit",
                "type": [
                  "string",
                  "null"
                ]
              },
              "taskId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Task that puts the check-in on the agenda and calendar"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "machineId",
              "orderId",
              "kind",
              "dueOn",
              "status",
              "completedOn",
              "outcome",
              "taskId",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "activityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "checkIn",
          "activityId"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.board",
      "toolName": "tickets_board",
      "group": "tickets",
      "title": "Get the service board",
      "description": "Service tickets grouped by status in order: new, diagnosing, parts_on_order, scheduled, waiting_on_customer, resolved, follow_up_complete. Within each column down-priority tickets come first. Resolved and follow-up complete columns show only tickets closed in the last 30 days unless includeAllClosed is true.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "includeAllClosed": {
            "default": false,
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "new",
                    "diagnosing",
                    "parts_on_order",
                    "scheduled",
                    "waiting_on_customer",
                    "resolved",
                    "follow_up_complete"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "tickets": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "ticketNumber": {
                        "type": "string"
                      },
                      "accountId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "machineId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "contactId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "category": {
                        "type": "string",
                        "enum": [
                          "mechanical",
                          "electrical",
                          "controls",
                          "hydraulic",
                          "pneumatic",
                          "structural",
                          "calibration",
                          "operator_training",
                          "other"
                        ]
                      },
                      "priority": {
                        "type": "string",
                        "enum": [
                          "low",
                          "normal",
                          "high",
                          "down"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "new",
                          "diagnosing",
                          "parts_on_order",
                          "scheduled",
                          "waiting_on_customer",
                          "resolved",
                          "follow_up_complete"
                        ]
                      },
                      "rootCause": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "component_failure",
                              "manufacturing_defect",
                              "wear",
                              "operator_error",
                              "installation",
                              "shipping_damage",
                              "environment",
                              "design",
                              "unknown"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "resolution": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "staff",
                          "portal",
                          "email",
                          "agent"
                        ]
                      },
                      "assignedToUserId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "isWarranty": {
                        "type": "boolean",
                        "description": "Whether the work is covered by warranty"
                      },
                      "onsiteHours": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Total on-site hours logged"
                      },
                      "travelHours": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Total travel hours logged"
                      },
                      "travelMiles": {
                        "type": "number",
                        "minimum": 0,
                        "description": "Total travel miles logged"
                      },
                      "openedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      "scheduledFor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "resolvedAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                            "description": "UTC timestamp, ISO 8601 with Z"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "UTC timestamp, ISO 8601 with Z"
                      },
                      "accountName": {
                        "type": "string"
                      },
                      "machineSerialNumber": {
                        "type": "string"
                      },
                      "machineModel": {
                        "type": "string"
                      },
                      "assignedToName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "ticketNumber",
                      "accountId",
                      "machineId",
                      "contactId",
                      "title",
                      "description",
                      "category",
                      "priority",
                      "status",
                      "rootCause",
                      "resolution",
                      "source",
                      "assignedToUserId",
                      "isWarranty",
                      "onsiteHours",
                      "travelHours",
                      "travelMiles",
                      "openedAt",
                      "scheduledFor",
                      "resolvedAt",
                      "createdAt",
                      "updatedAt",
                      "accountName",
                      "machineSerialNumber",
                      "machineModel",
                      "assignedToName"
                    ],
                    "additionalProperties": false
                  },
                  "description": "Down tickets first, then by priority and age"
                }
              },
              "required": [
                "status",
                "label",
                "count",
                "tickets"
              ],
              "additionalProperties": false
            }
          },
          "openCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "downCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Open tickets with priority down"
          }
        },
        "required": [
          "columns",
          "openCount",
          "downCount"
        ],
        "additionalProperties": false
      },
      "view": "service-board"
    },
    {
      "name": "tickets.list",
      "toolName": "tickets_list",
      "group": "tickets",
      "title": "List service tickets",
      "description": "Service tickets as a flat list with filters for account, machine, status, priority, category and assignee.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "new",
              "diagnosing",
              "parts_on_order",
              "scheduled",
              "waiting_on_customer",
              "resolved",
              "follow_up_complete"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "down"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "mechanical",
              "electrical",
              "controls",
              "hydraulic",
              "pneumatic",
              "structural",
              "calibration",
              "operator_training",
              "other"
            ]
          },
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "open": {
            "description": "true for tickets not yet resolved, false for resolved and follow-up complete",
            "type": "boolean"
          },
          "query": {
            "description": "Matches ticket number, title, serial number or account name",
            "type": "string",
            "maxLength": 200
          },
          "sort": {
            "default": "priority",
            "type": "string",
            "enum": [
              "newest",
              "oldest",
              "priority"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "mechanical",
                    "electrical",
                    "controls",
                    "hydraulic",
                    "pneumatic",
                    "structural",
                    "calibration",
                    "operator_training",
                    "other"
                  ]
                },
                "priority": {
                  "type": "string",
                  "enum": [
                    "low",
                    "normal",
                    "high",
                    "down"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "new",
                    "diagnosing",
                    "parts_on_order",
                    "scheduled",
                    "waiting_on_customer",
                    "resolved",
                    "follow_up_complete"
                  ]
                },
                "rootCause": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "component_failure",
                        "manufacturing_defect",
                        "wear",
                        "operator_error",
                        "installation",
                        "shipping_damage",
                        "environment",
                        "design",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolution": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "staff",
                    "portal",
                    "email",
                    "agent"
                  ]
                },
                "assignedToUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isWarranty": {
                  "type": "boolean",
                  "description": "Whether the work is covered by warranty"
                },
                "onsiteHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total on-site hours logged"
                },
                "travelHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel hours logged"
                },
                "travelMiles": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Total travel miles logged"
                },
                "openedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "scheduledFor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolvedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "machineModel": {
                  "type": "string"
                },
                "assignedToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "ticketNumber",
                "accountId",
                "machineId",
                "contactId",
                "title",
                "description",
                "category",
                "priority",
                "status",
                "rootCause",
                "resolution",
                "source",
                "assignedToUserId",
                "isWarranty",
                "onsiteHours",
                "travelHours",
                "travelMiles",
                "openedAt",
                "scheduledFor",
                "resolvedAt",
                "createdAt",
                "updatedAt",
                "accountName",
                "machineSerialNumber",
                "machineModel",
                "assignedToName"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.get",
      "toolName": "tickets_get",
      "group": "tickets",
      "title": "Get a service ticket",
      "description": "One ticket by id or ticket number with its machine, parts used, time entries (on-site hours, travel), warranty claims, documents and related activity.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketNumber": {
            "type": "string",
            "maxLength": 40
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "mechanical",
              "electrical",
              "controls",
              "hydraulic",
              "pneumatic",
              "structural",
              "calibration",
              "operator_training",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "down"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "new",
              "diagnosing",
              "parts_on_order",
              "scheduled",
              "waiting_on_customer",
              "resolved",
              "follow_up_complete"
            ]
          },
          "rootCause": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "component_failure",
                  "manufacturing_defect",
                  "wear",
                  "operator_error",
                  "installation",
                  "shipping_damage",
                  "environment",
                  "design",
                  "unknown"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "staff",
              "portal",
              "email",
              "agent"
            ]
          },
          "assignedToUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "isWarranty": {
            "type": "boolean",
            "description": "Whether the work is covered by warranty"
          },
          "onsiteHours": {
            "type": "number",
            "minimum": 0,
            "description": "Total on-site hours logged"
          },
          "travelHours": {
            "type": "number",
            "minimum": 0,
            "description": "Total travel hours logged"
          },
          "travelMiles": {
            "type": "number",
            "minimum": 0,
            "description": "Total travel miles logged"
          },
          "openedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "scheduledFor": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolvedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "machineSerialNumber": {
            "type": "string"
          },
          "machineModel": {
            "type": "string"
          },
          "assignedToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "coveredByWarranty": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "ticketId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "coveredByWarranty",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "timeEntries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "workDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "onsiteHours": {
                  "type": "number",
                  "minimum": 0
                },
                "travelHours": {
                  "type": "number",
                  "minimum": 0
                },
                "travelMiles": {
                  "type": "number",
                  "minimum": 0
                },
                "technicianName": {
                  "type": "string"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "ticketId",
                "workDate",
                "onsiteHours",
                "travelHours",
                "travelMiles",
                "technicianName",
                "note",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "warrantyClaims": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "claimNumber": {
                  "type": "string"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "submitted",
                    "approved",
                    "denied",
                    "credited"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountClaimedCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "creditCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Credit granted to the customer"
                },
                "submittedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "decidedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "claimNumber",
                "ticketId",
                "machineId",
                "accountId",
                "status",
                "description",
                "amountClaimedCents",
                "creditCents",
                "submittedOn",
                "decidedOn",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "stored"
                  ],
                  "description": "pending until the file bytes are stored"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerVisible": {
                  "type": "boolean",
                  "description": "Whether the customer can open it in the portal"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "email",
                    "portal",
                    "system",
                    "import"
                  ]
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "parts_order",
                          "part",
                          "opportunity",
                          "check_in"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      }
                    },
                    "required": [
                      "entityType",
                      "entityId"
                    ],
                    "additionalProperties": false
                  }
                },
                "uploadedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "status",
                "accountId",
                "customerVisible",
                "source",
                "links",
                "uploadedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "activities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "call",
                    "email",
                    "text",
                    "visit",
                    "note",
                    "system"
                  ]
                },
                "direction": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "outbound",
                        "inbound"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "subject": {
                  "type": "string"
                },
                "body": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "externalRef": {
                  "description": "Gmail message id for imported emails; unique",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "externalThreadId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fromAddress": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toAddresses": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "durationMinutes": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "description": "Attachments stored as documents"
                },
                "loggedByName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "type",
                "direction",
                "subject",
                "body",
                "occurredAt",
                "accountId",
                "contactId",
                "orderId",
                "machineId",
                "ticketId",
                "externalRef",
                "externalThreadId",
                "fromAddress",
                "toAddresses",
                "durationMinutes",
                "documentIds",
                "loggedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "machine": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "serialNumber": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "plant",
                  "mixer",
                  "silo",
                  "feeder",
                  "power_pack"
                ]
              },
              "model": {
                "type": "string"
              },
              "configuration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Current owner"
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current site"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Order the machine was built for"
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "in_build",
                  "in_transit",
                  "operating",
                  "down",
                  "idle",
                  "retired"
                ]
              },
              "builtOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissionedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyStart": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyEnd": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "warrantyState": {
                "type": "string",
                "enum": [
                  "none",
                  "active",
                  "expiring",
                  "expired"
                ],
                "description": "Computed from the warranty dates and today's date"
              },
              "warrantyDaysLeft": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Days until the warranty ends; negative once expired; null if not started"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "serialNumber",
              "type",
              "model",
              "configuration",
              "options",
              "accountId",
              "siteId",
              "orderId",
              "productId",
              "status",
              "builtOn",
              "shippedOn",
              "commissionedOn",
              "warrantyStart",
              "warrantyEnd",
              "warrantyState",
              "warrantyDaysLeft",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "ticketNumber",
          "accountId",
          "machineId",
          "contactId",
          "title",
          "description",
          "category",
          "priority",
          "status",
          "rootCause",
          "resolution",
          "source",
          "assignedToUserId",
          "isWarranty",
          "onsiteHours",
          "travelHours",
          "travelMiles",
          "openedAt",
          "scheduledFor",
          "resolvedAt",
          "createdAt",
          "updatedAt",
          "accountName",
          "machineSerialNumber",
          "machineModel",
          "assignedToName",
          "parts",
          "timeEntries",
          "warrantyClaims",
          "documents",
          "activities",
          "machine"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.open",
      "toolName": "tickets_open",
      "group": "tickets",
      "title": "Open a service ticket",
      "description": "Open a service ticket on a machine (by machineId or serial number). Priority down means the machine cannot produce: it marks the machine down until the ticket is resolved. The ticket number is assigned automatically and the ticket starts at status new.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "serialNumber": {
            "type": "string",
            "maxLength": 60
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "default": "other",
            "type": "string",
            "enum": [
              "mechanical",
              "electrical",
              "controls",
              "hydraulic",
              "pneumatic",
              "structural",
              "calibration",
              "operator_training",
              "other"
            ]
          },
          "priority": {
            "default": "normal",
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "down"
            ]
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignedToUserId": {
            "description": "Defaults to the caller",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "scheduledFor": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "isWarranty": {
            "description": "Defaults to whether the machine is under warranty today",
            "type": "boolean"
          },
          "source": {
            "default": "staff",
            "type": "string",
            "enum": [
              "staff",
              "portal",
              "email",
              "agent"
            ]
          }
        },
        "required": [
          "title"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticket": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string",
                "enum": [
                  "mechanical",
                  "electrical",
                  "controls",
                  "hydraulic",
                  "pneumatic",
                  "structural",
                  "calibration",
                  "operator_training",
                  "other"
                ]
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "down"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "new",
                  "diagnosing",
                  "parts_on_order",
                  "scheduled",
                  "waiting_on_customer",
                  "resolved",
                  "follow_up_complete"
                ]
              },
              "rootCause": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "component_failure",
                      "manufacturing_defect",
                      "wear",
                      "operator_error",
                      "installation",
                      "shipping_damage",
                      "environment",
                      "design",
                      "unknown"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolution": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "staff",
                  "portal",
                  "email",
                  "agent"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isWarranty": {
                "type": "boolean",
                "description": "Whether the work is covered by warranty"
              },
              "onsiteHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total on-site hours logged"
              },
              "travelHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel hours logged"
              },
              "travelMiles": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel miles logged"
              },
              "openedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "scheduledFor": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolvedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "ticketNumber",
              "accountId",
              "machineId",
              "contactId",
              "title",
              "description",
              "category",
              "priority",
              "status",
              "rootCause",
              "resolution",
              "source",
              "assignedToUserId",
              "isWarranty",
              "onsiteHours",
              "travelHours",
              "travelMiles",
              "openedAt",
              "scheduledFor",
              "resolvedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "machineEffect": {
            "type": "object",
            "properties": {
              "machine": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "serialNumber": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "plant",
                      "mixer",
                      "silo",
                      "feeder",
                      "power_pack"
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "configuration": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Current owner"
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Current site"
                  },
                  "orderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Order the machine was built for"
                  },
                  "productId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_build",
                      "in_transit",
                      "operating",
                      "down",
                      "idle",
                      "retired"
                    ]
                  },
                  "builtOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shippedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissionedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyStart": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyState": {
                    "type": "string",
                    "enum": [
                      "none",
                      "active",
                      "expiring",
                      "expired"
                    ],
                    "description": "Computed from the warranty dates and today's date"
                  },
                  "warrantyDaysLeft": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Days until the warranty ends; negative once expired; null if not started"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "serialNumber",
                  "type",
                  "model",
                  "configuration",
                  "options",
                  "accountId",
                  "siteId",
                  "orderId",
                  "productId",
                  "status",
                  "builtOn",
                  "shippedOn",
                  "commissionedOn",
                  "warrantyStart",
                  "warrantyEnd",
                  "warrantyState",
                  "warrantyDaysLeft",
                  "notes",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              "statusChanged": {
                "type": "boolean"
              },
              "previousStatus": {
                "type": "string"
              }
            },
            "required": [
              "machine",
              "statusChanged",
              "previousStatus"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ticket",
          "machineEffect"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.update",
      "toolName": "tickets_update",
      "group": "tickets",
      "title": "Update a service ticket",
      "description": "Change a ticket's title, description, category, priority, root cause, resolution, assignee, contact, scheduled date or warranty flag. Only the fields you send are changed. Raising the priority to down marks the machine down; lowering it from down returns the machine to operating if no other down ticket is open. Use tickets.set_status to change status.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "mechanical",
              "electrical",
              "controls",
              "hydraulic",
              "pneumatic",
              "structural",
              "calibration",
              "operator_training",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "down"
            ]
          },
          "rootCause": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "component_failure",
                  "manufacturing_defect",
                  "wear",
                  "operator_error",
                  "installation",
                  "shipping_damage",
                  "environment",
                  "design",
                  "unknown"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignedToUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "scheduledFor": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "isWarranty": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticket": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string",
                "enum": [
                  "mechanical",
                  "electrical",
                  "controls",
                  "hydraulic",
                  "pneumatic",
                  "structural",
                  "calibration",
                  "operator_training",
                  "other"
                ]
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "down"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "new",
                  "diagnosing",
                  "parts_on_order",
                  "scheduled",
                  "waiting_on_customer",
                  "resolved",
                  "follow_up_complete"
                ]
              },
              "rootCause": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "component_failure",
                      "manufacturing_defect",
                      "wear",
                      "operator_error",
                      "installation",
                      "shipping_damage",
                      "environment",
                      "design",
                      "unknown"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolution": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "staff",
                  "portal",
                  "email",
                  "agent"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isWarranty": {
                "type": "boolean",
                "description": "Whether the work is covered by warranty"
              },
              "onsiteHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total on-site hours logged"
              },
              "travelHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel hours logged"
              },
              "travelMiles": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel miles logged"
              },
              "openedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "scheduledFor": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolvedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "ticketNumber",
              "accountId",
              "machineId",
              "contactId",
              "title",
              "description",
              "category",
              "priority",
              "status",
              "rootCause",
              "resolution",
              "source",
              "assignedToUserId",
              "isWarranty",
              "onsiteHours",
              "travelHours",
              "travelMiles",
              "openedAt",
              "scheduledFor",
              "resolvedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "machineEffect": {
            "type": "object",
            "properties": {
              "machine": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "serialNumber": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "plant",
                      "mixer",
                      "silo",
                      "feeder",
                      "power_pack"
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "configuration": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Current owner"
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Current site"
                  },
                  "orderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Order the machine was built for"
                  },
                  "productId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_build",
                      "in_transit",
                      "operating",
                      "down",
                      "idle",
                      "retired"
                    ]
                  },
                  "builtOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shippedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissionedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyStart": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyState": {
                    "type": "string",
                    "enum": [
                      "none",
                      "active",
                      "expiring",
                      "expired"
                    ],
                    "description": "Computed from the warranty dates and today's date"
                  },
                  "warrantyDaysLeft": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Days until the warranty ends; negative once expired; null if not started"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "serialNumber",
                  "type",
                  "model",
                  "configuration",
                  "options",
                  "accountId",
                  "siteId",
                  "orderId",
                  "productId",
                  "status",
                  "builtOn",
                  "shippedOn",
                  "commissionedOn",
                  "warrantyStart",
                  "warrantyEnd",
                  "warrantyState",
                  "warrantyDaysLeft",
                  "notes",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              "statusChanged": {
                "type": "boolean"
              },
              "previousStatus": {
                "type": "string"
              }
            },
            "required": [
              "machine",
              "statusChanged",
              "previousStatus"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ticket",
          "machineEffect"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.set_status",
      "toolName": "tickets_set_status",
      "group": "tickets",
      "title": "Change a ticket's status",
      "description": "Move a ticket to any status: new, diagnosing, parts_on_order, scheduled, waiting_on_customer, resolved, follow_up_complete. This is what a drag on the service board does. Resolving a down ticket returns its machine to operating (unless another down ticket is still open); reopening a down ticket marks the machine down again. Resolving records the resolved time; a root cause and resolution can be given in the same call.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "new",
              "diagnosing",
              "parts_on_order",
              "scheduled",
              "waiting_on_customer",
              "resolved",
              "follow_up_complete"
            ]
          },
          "rootCause": {
            "type": "string",
            "enum": [
              "component_failure",
              "manufacturing_defect",
              "wear",
              "operator_error",
              "installation",
              "shipping_damage",
              "environment",
              "design",
              "unknown"
            ]
          },
          "resolution": {
            "type": "string",
            "maxLength": 20000
          },
          "scheduledFor": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticket": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string",
                "enum": [
                  "mechanical",
                  "electrical",
                  "controls",
                  "hydraulic",
                  "pneumatic",
                  "structural",
                  "calibration",
                  "operator_training",
                  "other"
                ]
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "down"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "new",
                  "diagnosing",
                  "parts_on_order",
                  "scheduled",
                  "waiting_on_customer",
                  "resolved",
                  "follow_up_complete"
                ]
              },
              "rootCause": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "component_failure",
                      "manufacturing_defect",
                      "wear",
                      "operator_error",
                      "installation",
                      "shipping_damage",
                      "environment",
                      "design",
                      "unknown"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolution": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "staff",
                  "portal",
                  "email",
                  "agent"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isWarranty": {
                "type": "boolean",
                "description": "Whether the work is covered by warranty"
              },
              "onsiteHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total on-site hours logged"
              },
              "travelHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel hours logged"
              },
              "travelMiles": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel miles logged"
              },
              "openedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "scheduledFor": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolvedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "ticketNumber",
              "accountId",
              "machineId",
              "contactId",
              "title",
              "description",
              "category",
              "priority",
              "status",
              "rootCause",
              "resolution",
              "source",
              "assignedToUserId",
              "isWarranty",
              "onsiteHours",
              "travelHours",
              "travelMiles",
              "openedAt",
              "scheduledFor",
              "resolvedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "previousStatus": {
            "type": "string",
            "enum": [
              "new",
              "diagnosing",
              "parts_on_order",
              "scheduled",
              "waiting_on_customer",
              "resolved",
              "follow_up_complete"
            ]
          },
          "machineEffect": {
            "type": "object",
            "properties": {
              "machine": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "serialNumber": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "plant",
                      "mixer",
                      "silo",
                      "feeder",
                      "power_pack"
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "configuration": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Current owner"
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Current site"
                  },
                  "orderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Order the machine was built for"
                  },
                  "productId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_build",
                      "in_transit",
                      "operating",
                      "down",
                      "idle",
                      "retired"
                    ]
                  },
                  "builtOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "shippedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "commissionedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyStart": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "warrantyState": {
                    "type": "string",
                    "enum": [
                      "none",
                      "active",
                      "expiring",
                      "expired"
                    ],
                    "description": "Computed from the warranty dates and today's date"
                  },
                  "warrantyDaysLeft": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Days until the warranty ends; negative once expired; null if not started"
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "serialNumber",
                  "type",
                  "model",
                  "configuration",
                  "options",
                  "accountId",
                  "siteId",
                  "orderId",
                  "productId",
                  "status",
                  "builtOn",
                  "shippedOn",
                  "commissionedOn",
                  "warrantyStart",
                  "warrantyEnd",
                  "warrantyState",
                  "warrantyDaysLeft",
                  "notes",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              "statusChanged": {
                "type": "boolean"
              },
              "previousStatus": {
                "type": "string"
              }
            },
            "required": [
              "machine",
              "statusChanged",
              "previousStatus"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ticket",
          "previousStatus",
          "machineEffect"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.log_parts",
      "toolName": "tickets_log_parts",
      "group": "tickets",
      "title": "Log parts used on a ticket",
      "description": "Record parts used to fix a ticket, by part id or part number. With deductStock true (the default) each part is taken out of stock through a ledger row. Parts on a warranty ticket are marked covered unless stated otherwise.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "parts": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string",
                  "maxLength": 60
                },
                "quantity": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "description": "Defaults to the catalog price",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "coveredByWarranty": {
                  "type": "boolean"
                }
              }
            }
          },
          "deductStock": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "ticketId",
          "parts"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "coveredByWarranty": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "ticketId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "coveredByWarranty",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "stockMovementIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          },
          "lowStockPartNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts now at or below their reorder point"
          }
        },
        "required": [
          "parts",
          "stockMovementIds",
          "lowStockPartNumbers"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.remove_part",
      "toolName": "tickets_remove_part",
      "group": "tickets",
      "title": "Remove a part from a ticket",
      "description": "Remove a part line logged on a ticket by mistake. If stock was deducted for it, the stock is returned through a ledger row.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticketPartId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ticketPartId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tickets.log_time",
      "toolName": "tickets_log_time",
      "group": "tickets",
      "title": "Log time and travel on a ticket",
      "description": "Record on-site hours, travel hours and travel miles for a day of work on a ticket. The ticket's totals are the sum of its time entries.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "workDate": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "onsiteHours": {
            "default": 0,
            "type": "number",
            "minimum": 0,
            "maximum": 24
          },
          "travelHours": {
            "default": 0,
            "type": "number",
            "minimum": 0,
            "maximum": 48
          },
          "travelMiles": {
            "default": 0,
            "type": "number",
            "minimum": 0,
            "maximum": 10000
          },
          "technicianName": {
            "description": "Defaults to the caller's name",
            "type": "string",
            "maxLength": 200
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ticketId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "entry": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "workDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "onsiteHours": {
                "type": "number",
                "minimum": 0
              },
              "travelHours": {
                "type": "number",
                "minimum": 0
              },
              "travelMiles": {
                "type": "number",
                "minimum": 0
              },
              "technicianName": {
                "type": "string"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "ticketId",
              "workDate",
              "onsiteHours",
              "travelHours",
              "travelMiles",
              "technicianName",
              "note",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "ticket": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string",
                "enum": [
                  "mechanical",
                  "electrical",
                  "controls",
                  "hydraulic",
                  "pneumatic",
                  "structural",
                  "calibration",
                  "operator_training",
                  "other"
                ]
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "down"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "new",
                  "diagnosing",
                  "parts_on_order",
                  "scheduled",
                  "waiting_on_customer",
                  "resolved",
                  "follow_up_complete"
                ]
              },
              "rootCause": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "component_failure",
                      "manufacturing_defect",
                      "wear",
                      "operator_error",
                      "installation",
                      "shipping_damage",
                      "environment",
                      "design",
                      "unknown"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolution": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "staff",
                  "portal",
                  "email",
                  "agent"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isWarranty": {
                "type": "boolean",
                "description": "Whether the work is covered by warranty"
              },
              "onsiteHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total on-site hours logged"
              },
              "travelHours": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel hours logged"
              },
              "travelMiles": {
                "type": "number",
                "minimum": 0,
                "description": "Total travel miles logged"
              },
              "openedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "scheduledFor": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolvedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "ticketNumber",
              "accountId",
              "machineId",
              "contactId",
              "title",
              "description",
              "category",
              "priority",
              "status",
              "rootCause",
              "resolution",
              "source",
              "assignedToUserId",
              "isWarranty",
              "onsiteHours",
              "travelHours",
              "travelMiles",
              "openedAt",
              "scheduledFor",
              "resolvedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "entry",
          "ticket"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "warranty_claims.list",
      "toolName": "warranty_claims_list",
      "group": "warranty_claims",
      "title": "List warranty claims",
      "description": "Warranty claims with filters for account, machine, ticket and status. Each claim is linked to a service ticket and records the credit granted.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitted",
              "approved",
              "denied",
              "credited"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "claimNumber": {
                  "type": "string"
                },
                "ticketId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "submitted",
                    "approved",
                    "denied",
                    "credited"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountClaimedCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "creditCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Credit granted to the customer"
                },
                "submittedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "decidedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "ticketNumber": {
                  "type": "string"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "accountName": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "claimNumber",
                "ticketId",
                "machineId",
                "accountId",
                "status",
                "description",
                "amountClaimedCents",
                "creditCents",
                "submittedOn",
                "decidedOn",
                "notes",
                "createdAt",
                "updatedAt",
                "ticketNumber",
                "machineSerialNumber",
                "accountName"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "warranty_claims.create",
      "toolName": "warranty_claims_create",
      "group": "warranty_claims",
      "title": "File a warranty claim on a ticket",
      "description": "Create a warranty claim linked to a service ticket. The machine and account come from the ticket. The response says whether the machine was under warranty on the ticket's open date; a claim on a machine out of warranty is allowed but flagged.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "amountClaimedCents": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "submittedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ticketId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "claim": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "claimNumber": {
                "type": "string"
              },
              "ticketId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "status": {
                "type": "string",
                "enum": [
                  "submitted",
                  "approved",
                  "denied",
                  "credited"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "amountClaimedCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "creditCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Credit granted to the customer"
              },
              "submittedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "decidedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "claimNumber",
              "ticketId",
              "machineId",
              "accountId",
              "status",
              "description",
              "amountClaimedCents",
              "creditCents",
              "submittedOn",
              "decidedOn",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "underWarranty": {
            "type": "boolean"
          }
        },
        "required": [
          "claim",
          "underWarranty"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "warranty_claims.update",
      "toolName": "warranty_claims_update",
      "group": "warranty_claims",
      "title": "Update a warranty claim",
      "description": "Change a claim's status (submitted, approved, denied, credited), the amount claimed, the credit granted, the decision date or notes. Setting status credited requires a credit amount.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitted",
              "approved",
              "denied",
              "credited"
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "amountClaimedCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "creditCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "decidedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "claim": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "claimNumber": {
                "type": "string"
              },
              "ticketId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "status": {
                "type": "string",
                "enum": [
                  "submitted",
                  "approved",
                  "denied",
                  "credited"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "amountClaimedCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "creditCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Credit granted to the customer"
              },
              "submittedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "decidedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "claimNumber",
              "ticketId",
              "machineId",
              "accountId",
              "status",
              "description",
              "amountClaimedCents",
              "creditCents",
              "submittedOn",
              "decidedOn",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "claim"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.search",
      "toolName": "parts_search",
      "group": "parts",
      "title": "Search the parts catalog",
      "description": "Search the Master Parts List by part number or description, optionally only parts that fit a model. Each part shows price, the date of the price list it came from, a stale flag when that price is older than the current list, stock on hand and whether it is low.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "query": {
            "description": "Part number or words from the description",
            "type": "string",
            "maxLength": 200
          },
          "fitsModel": {
            "description": "For example Model 300",
            "type": "string",
            "maxLength": 100
          },
          "category": {
            "type": "string",
            "maxLength": 100
          },
          "staleOnly": {
            "default": false,
            "type": "boolean"
          },
          "lowStockOnly": {
            "default": false,
            "type": "boolean"
          },
          "inStockOnly": {
            "default": false,
            "type": "boolean"
          },
          "activeOnly": {
            "default": true,
            "type": "boolean"
          },
          "sort": {
            "default": "part_number",
            "type": "string",
            "enum": [
              "part_number",
              "description",
              "on_hand",
              "price"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": "string",
                  "description": "Unit of measure, for example each, ft, set"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceListDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date of the price list this price comes from"
                },
                "isStale": {
                  "type": "boolean",
                  "description": "True when the price is older than the current price list"
                },
                "fitsModels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Machine models the part fits"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand; changes only through stock movements"
                },
                "reorderPoint": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reorderQuantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "isLow": {
                  "type": "boolean",
                  "description": "True when on hand is at or below the reorder point"
                },
                "binLocation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recommendedSpare": {
                  "type": "boolean",
                  "description": "Recommended to keep on the customer's shelf"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partNumber",
                "description",
                "category",
                "unit",
                "priceCents",
                "priceListDate",
                "isStale",
                "fitsModels",
                "onHand",
                "reorderPoint",
                "reorderQuantity",
                "isLow",
                "binLocation",
                "recommendedSpare",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.get",
      "toolName": "parts_get",
      "group": "parts",
      "title": "Get a part",
      "description": "One part by id or part number, with its latest stock movements.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "recentMovements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receive",
                    "adjust",
                    "ship",
                    "return"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Signed change: positive adds stock, negative removes it"
                },
                "balanceAfter": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand after this movement"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "partsOrderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitCostCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partId",
                "partNumber",
                "type",
                "quantity",
                "balanceAfter",
                "reason",
                "partsOrderId",
                "ticketId",
                "unitCostCents",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "part",
          "recentMovements"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.upsert",
      "toolName": "parts_upsert",
      "group": "parts",
      "title": "Create or update a part",
      "description": "Add a part to the catalog or change one (matched by id, else by part number, which is unique). Stock on hand cannot be set here: use stock.receive or stock.adjust so the ledger stays complete.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "category": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "unit": {
            "default": "each",
            "type": "string",
            "maxLength": 20
          },
          "priceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "priceListDate": {
            "description": "Defaults to the current price list date for new parts",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "fitsModels": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100
            }
          },
          "reorderPoint": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reorderQuantity": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "binLocation": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "recommendedSpare": {
            "default": false,
            "type": "boolean"
          },
          "active": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "partNumber",
          "description",
          "priceCents"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "part",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.update_price",
      "toolName": "parts_update_price",
      "group": "parts",
      "title": "Update a part price",
      "description": "Set a new price for a part and stamp it with a price-list date (today's list by default), which clears the stale flag. Use this when confirming or correcting the 2020 prices from the old parts list.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          },
          "priceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "priceListDate": {
            "description": "Defaults to the current price list date",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          }
        },
        "required": [
          "priceCents"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "previousPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "previousPriceListDate": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          }
        },
        "required": [
          "part",
          "previousPriceCents",
          "previousPriceListDate"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.stale_prices",
      "toolName": "parts_stale_prices",
      "group": "parts",
      "title": "List parts with stale prices",
      "description": "Parts whose price comes from a price list older than the current one (for example the 2020 Master Parts List), oldest first, with the count of all stale parts.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": "string",
                  "description": "Unit of measure, for example each, ft, set"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceListDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date of the price list this price comes from"
                },
                "isStale": {
                  "type": "boolean",
                  "description": "True when the price is older than the current price list"
                },
                "fitsModels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Machine models the part fits"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand; changes only through stock movements"
                },
                "reorderPoint": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reorderQuantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "isLow": {
                  "type": "boolean",
                  "description": "True when on hand is at or below the reorder point"
                },
                "binLocation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recommendedSpare": {
                  "type": "boolean",
                  "description": "Recommended to keep on the customer's shelf"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partNumber",
                "description",
                "category",
                "unit",
                "priceCents",
                "priceListDate",
                "isStale",
                "fitsModels",
                "onHand",
                "reorderPoint",
                "reorderQuantity",
                "isLow",
                "binLocation",
                "recommendedSpare",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currentPriceListDate": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "currentPriceListDate"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.recommended_spares",
      "toolName": "parts_recommended_spares",
      "group": "parts",
      "title": "List recommended spare parts for a model",
      "description": "The spare parts Cemco recommends a customer keeps on the shelf for a machine model (or for one machine), with price and stock on hand. Use it to build a spares quote.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "maxLength": 100
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": "string",
                  "description": "Unit of measure, for example each, ft, set"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceListDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date of the price list this price comes from"
                },
                "isStale": {
                  "type": "boolean",
                  "description": "True when the price is older than the current price list"
                },
                "fitsModels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Machine models the part fits"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand; changes only through stock movements"
                },
                "reorderPoint": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reorderQuantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "isLow": {
                  "type": "boolean",
                  "description": "True when on hand is at or below the reorder point"
                },
                "binLocation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recommendedSpare": {
                  "type": "boolean",
                  "description": "Recommended to keep on the customer's shelf"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partNumber",
                "description",
                "category",
                "unit",
                "priceCents",
                "priceListDate",
                "isStale",
                "fitsModels",
                "onHand",
                "reorderPoint",
                "reorderQuantity",
                "isLow",
                "binLocation",
                "recommendedSpare",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          }
        },
        "required": [
          "model",
          "items",
          "totalCents"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts.deactivate",
      "toolName": "parts_deactivate",
      "group": "parts",
      "title": "Retire a part",
      "description": "Mark a part inactive so it no longer appears in searches or on new quotes. History is kept. Pass active true to bring it back.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "active": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "part"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.list",
      "toolName": "parts_orders_list",
      "group": "parts_orders",
      "title": "List parts quotes and orders",
      "description": "Parts quotes and parts orders with filters for account, status and machine. A quote is a parts order with status quote.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "open": {
            "description": "true for quote, ordered and shipped; false for delivered and cancelled",
            "type": "boolean"
          },
          "query": {
            "description": "Matches order number, tracking number, customer PO or account name",
            "type": "string",
            "maxLength": 200
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderNumber": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "quote",
                    "ordered",
                    "shipped",
                    "delivered",
                    "cancelled"
                  ]
                },
                "subtotalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "shippingCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "taxCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "quotedOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "quoteValidUntil": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "deliveredOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "carrier": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "trackingNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "shipToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "shipToAddress": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customerPo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "lineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "orderNumber",
                "accountId",
                "contactId",
                "machineId",
                "ticketId",
                "status",
                "subtotalCents",
                "shippingCents",
                "taxCents",
                "totalCents",
                "quotedOn",
                "quoteValidUntil",
                "orderedOn",
                "shippedOn",
                "deliveredOn",
                "carrier",
                "trackingNumber",
                "shipToName",
                "shipToAddress",
                "customerPo",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "lineCount"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.get",
      "toolName": "parts_orders_get",
      "group": "parts_orders",
      "title": "Get a parts quote or order",
      "description": "One parts order by id or order number with its lines, totals, status dates, carrier and tracking number.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string",
            "maxLength": 40
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      },
      "view": "parts-order"
    },
    {
      "name": "parts_orders.create",
      "toolName": "parts_orders_create",
      "group": "parts_orders",
      "title": "Start a parts quote",
      "description": "Create a parts quote for an account, optionally tied to a machine or service ticket, with its first lines. It starts at status quote; nothing leaves stock until it ships. The order number is assigned automatically.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "quoteValidUntil": {
            "description": "Defaults to 30 days from today",
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippingCents": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shipToName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "shipToAddress": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "customerPo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string",
                  "maxLength": 60
                },
                "quantity": {
                  "default": 1,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "description": "Defaults to the catalog price",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              }
            }
          }
        },
        "required": [
          "accountId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.update",
      "toolName": "parts_orders_update",
      "group": "parts_orders",
      "title": "Update a parts quote or order",
      "description": "Change the contact, machine, ticket, shipping, tax, ship-to, customer PO, validity date or notes of a parts order. Totals are recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shipToName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "shipToAddress": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "customerPo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.add_line",
      "toolName": "parts_orders_add_line",
      "group": "parts_orders",
      "title": "Add a part to a parts quote",
      "description": "Add a part line (by part id or part number) to a parts order that is still a quote or ordered. Adding a part already on the order increases its quantity. Totals are recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "partsOrderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          },
          "quantity": {
            "default": 1,
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          }
        },
        "required": [
          "partsOrderId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.update_line",
      "toolName": "parts_orders_update_line",
      "group": "parts_orders",
      "title": "Change a parts order line",
      "description": "Change the quantity or unit price of a line on a parts order that has not shipped. Totals are recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          }
        },
        "required": [
          "lineId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.remove_line",
      "toolName": "parts_orders_remove_line",
      "group": "parts_orders",
      "title": "Remove a parts order line",
      "description": "Delete a line from a parts order that has not shipped. Totals are recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "lineId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "quote",
                  "ordered",
                  "shipped",
                  "delivered",
                  "cancelled"
                ]
              },
              "subtotalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "shippingCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "taxCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "quotedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "quoteValidUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deliveredOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "carrier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "trackingNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerPo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountName": {
                "type": "string"
              },
              "lineCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partsOrderId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partNumber": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "unitPriceCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "onHand": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Current stock of the part, for the quote builder"
                    }
                  },
                  "required": [
                    "id",
                    "partsOrderId",
                    "partId",
                    "partNumber",
                    "description",
                    "quantity",
                    "unitPriceCents",
                    "totalCents",
                    "onHand"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "contactId",
              "machineId",
              "ticketId",
              "status",
              "subtotalCents",
              "shippingCents",
              "taxCents",
              "totalCents",
              "quotedOn",
              "quoteValidUntil",
              "orderedOn",
              "shippedOn",
              "deliveredOn",
              "carrier",
              "trackingNumber",
              "shipToName",
              "shipToAddress",
              "customerPo",
              "notes",
              "createdAt",
              "updatedAt",
              "accountName",
              "lineCount",
              "lines"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "id",
          "order"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.place",
      "toolName": "parts_orders_place",
      "group": "parts_orders",
      "title": "Turn a parts quote into an order",
      "description": "The customer accepted the quote: move it from quote to ordered and record the order date and customer PO. The response lists any lines with less stock on hand than ordered.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "customerPo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "quote",
                  "ordered",
                  "shipped",
                  "delivered",
                  "cancelled"
                ]
              },
              "subtotalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "shippingCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "taxCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "quotedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "quoteValidUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deliveredOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "carrier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "trackingNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerPo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountName": {
                "type": "string"
              },
              "lineCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partsOrderId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partNumber": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "unitPriceCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "onHand": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Current stock of the part, for the quote builder"
                    }
                  },
                  "required": [
                    "id",
                    "partsOrderId",
                    "partId",
                    "partNumber",
                    "description",
                    "quantity",
                    "unitPriceCents",
                    "totalCents",
                    "onHand"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "contactId",
              "machineId",
              "ticketId",
              "status",
              "subtotalCents",
              "shippingCents",
              "taxCents",
              "totalCents",
              "quotedOn",
              "quoteValidUntil",
              "orderedOn",
              "shippedOn",
              "deliveredOn",
              "carrier",
              "trackingNumber",
              "shipToName",
              "shipToAddress",
              "customerPo",
              "notes",
              "createdAt",
              "updatedAt",
              "accountName",
              "lineCount",
              "lines"
            ],
            "additionalProperties": false
          },
          "shortages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partNumber": {
                  "type": "string"
                },
                "ordered": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "partNumber",
                "ordered",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "order",
          "shortages"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.ship",
      "toolName": "parts_orders_ship",
      "group": "parts_orders",
      "title": "Ship a parts order",
      "description": "Mark an ordered parts order shipped with the carrier and tracking number. Shipping deducts every line from stock and writes one stock ledger row per part. Fails with a conflict if any line has less stock than ordered, unless allowNegativeStock is true. The customer is emailed the tracking number.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "carrier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "trackingNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "shippedOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "allowNegativeStock": {
            "default": false,
            "type": "boolean"
          },
          "notifyCustomer": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "carrier",
          "trackingNumber"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "quote",
                  "ordered",
                  "shipped",
                  "delivered",
                  "cancelled"
                ]
              },
              "subtotalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "shippingCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "taxCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "quotedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "quoteValidUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deliveredOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "carrier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "trackingNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerPo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountName": {
                "type": "string"
              },
              "lineCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partsOrderId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partNumber": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "unitPriceCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "onHand": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Current stock of the part, for the quote builder"
                    }
                  },
                  "required": [
                    "id",
                    "partsOrderId",
                    "partId",
                    "partNumber",
                    "description",
                    "quantity",
                    "unitPriceCents",
                    "totalCents",
                    "onHand"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "contactId",
              "machineId",
              "ticketId",
              "status",
              "subtotalCents",
              "shippingCents",
              "taxCents",
              "totalCents",
              "quotedOn",
              "quoteValidUntil",
              "orderedOn",
              "shippedOn",
              "deliveredOn",
              "carrier",
              "trackingNumber",
              "shipToName",
              "shipToAddress",
              "customerPo",
              "notes",
              "createdAt",
              "updatedAt",
              "accountName",
              "lineCount",
              "lines"
            ],
            "additionalProperties": false
          },
          "movements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receive",
                    "adjust",
                    "ship",
                    "return"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Signed change: positive adds stock, negative removes it"
                },
                "balanceAfter": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand after this movement"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "partsOrderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitCostCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partId",
                "partNumber",
                "type",
                "quantity",
                "balanceAfter",
                "reason",
                "partsOrderId",
                "ticketId",
                "unitCostCents",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "lowStockPartNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Parts now at or below their reorder point"
          },
          "emailQueued": {
            "type": "boolean"
          }
        },
        "required": [
          "order",
          "movements",
          "lowStockPartNumbers",
          "emailQueued"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.deliver",
      "toolName": "parts_orders_deliver",
      "group": "parts_orders",
      "title": "Mark a parts order delivered",
      "description": "Record that a shipped parts order arrived.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "deliveredOn": {
            "description": "Defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "quote",
              "ordered",
              "shipped",
              "delivered",
              "cancelled"
            ]
          },
          "subtotalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "shippingCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "taxCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "quotedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "quoteValidUntil": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shippedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToName": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipToAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerPo": {
            "type": [
              "string",
              "null"
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "accountName": {
            "type": "string"
          },
          "lineCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partsOrderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Current stock of the part, for the quote builder"
                }
              },
              "required": [
                "id",
                "partsOrderId",
                "partId",
                "partNumber",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents",
                "onHand"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "orderNumber",
          "accountId",
          "contactId",
          "machineId",
          "ticketId",
          "status",
          "subtotalCents",
          "shippingCents",
          "taxCents",
          "totalCents",
          "quotedOn",
          "quoteValidUntil",
          "orderedOn",
          "shippedOn",
          "deliveredOn",
          "carrier",
          "trackingNumber",
          "shipToName",
          "shipToAddress",
          "customerPo",
          "notes",
          "createdAt",
          "updatedAt",
          "accountName",
          "lineCount",
          "lines"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.cancel",
      "toolName": "parts_orders_cancel",
      "group": "parts_orders",
      "title": "Cancel a parts quote or order",
      "description": "Cancel a parts order. If it had already shipped, the parts are returned to stock through return ledger rows when restock is true.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "restock": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "quote",
                  "ordered",
                  "shipped",
                  "delivered",
                  "cancelled"
                ]
              },
              "subtotalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "shippingCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "taxCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "quotedOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              "quoteValidUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shippedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deliveredOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "carrier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "trackingNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "shipToAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerPo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountName": {
                "type": "string"
              },
              "lineCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partsOrderId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "partNumber": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "unitPriceCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "onHand": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Current stock of the part, for the quote builder"
                    }
                  },
                  "required": [
                    "id",
                    "partsOrderId",
                    "partId",
                    "partNumber",
                    "description",
                    "quantity",
                    "unitPriceCents",
                    "totalCents",
                    "onHand"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "orderNumber",
              "accountId",
              "contactId",
              "machineId",
              "ticketId",
              "status",
              "subtotalCents",
              "shippingCents",
              "taxCents",
              "totalCents",
              "quotedOn",
              "quoteValidUntil",
              "orderedOn",
              "shippedOn",
              "deliveredOn",
              "carrier",
              "trackingNumber",
              "shipToName",
              "shipToAddress",
              "customerPo",
              "notes",
              "createdAt",
              "updatedAt",
              "accountName",
              "lineCount",
              "lines"
            ],
            "additionalProperties": false
          },
          "movements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receive",
                    "adjust",
                    "ship",
                    "return"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Signed change: positive adds stock, negative removes it"
                },
                "balanceAfter": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand after this movement"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "partsOrderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitCostCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partId",
                "partNumber",
                "type",
                "quantity",
                "balanceAfter",
                "reason",
                "partsOrderId",
                "ticketId",
                "unitCostCents",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "order",
          "movements"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "parts_orders.export",
      "toolName": "parts_orders_export",
      "group": "parts_orders",
      "title": "Export a parts quote or order",
      "description": "Produce a parts quote or order as a printable HTML document, CSV of the lines, or JSON.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "format": {
            "default": "html",
            "type": "string",
            "enum": [
              "json",
              "csv",
              "html"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "The exported file as text (JSON, CSV or printable HTML)"
          }
        },
        "required": [
          "filename",
          "contentType",
          "content"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "stock.receive",
      "toolName": "stock_receive",
      "group": "stock",
      "title": "Receive parts into stock",
      "description": "Record parts arriving from a supplier. Adds the quantity to stock on hand and writes a receive row to the stock ledger for each part. Several parts can be received in one call.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string",
                  "maxLength": 60
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitCostCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                }
              },
              "required": [
                "quantity"
              ]
            }
          },
          "reason": {
            "description": "For example the supplier and packing slip number",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "movements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receive",
                    "adjust",
                    "ship",
                    "return"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Signed change: positive adds stock, negative removes it"
                },
                "balanceAfter": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand after this movement"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "partsOrderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitCostCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partId",
                "partNumber",
                "type",
                "quantity",
                "balanceAfter",
                "reason",
                "partsOrderId",
                "ticketId",
                "unitCostCents",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": "string",
                  "description": "Unit of measure, for example each, ft, set"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceListDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date of the price list this price comes from"
                },
                "isStale": {
                  "type": "boolean",
                  "description": "True when the price is older than the current price list"
                },
                "fitsModels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Machine models the part fits"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand; changes only through stock movements"
                },
                "reorderPoint": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reorderQuantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "isLow": {
                  "type": "boolean",
                  "description": "True when on hand is at or below the reorder point"
                },
                "binLocation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recommendedSpare": {
                  "type": "boolean",
                  "description": "Recommended to keep on the customer's shelf"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partNumber",
                "description",
                "category",
                "unit",
                "priceCents",
                "priceListDate",
                "isStale",
                "fitsModels",
                "onHand",
                "reorderPoint",
                "reorderQuantity",
                "isLow",
                "binLocation",
                "recommendedSpare",
                "active",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "movements",
          "parts"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "stock.adjust",
      "toolName": "stock_adjust",
      "group": "stock",
      "title": "Adjust stock on hand",
      "description": "Correct the stock of one part after a count, damage or loss. Give either the counted quantity (countedQuantity) or a signed change (delta). Writes an adjust row to the ledger with the reason, which is required.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "partId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          },
          "delta": {
            "description": "Signed change, for example -2",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "countedQuantity": {
            "description": "What is actually on the shelf",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        },
        "required": [
          "reason"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "movement": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "partId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "partNumber": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "receive",
                      "adjust",
                      "ship",
                      "return"
                    ]
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991,
                    "description": "Signed change: positive adds stock, negative removes it"
                  },
                  "balanceAfter": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991,
                    "description": "Stock on hand after this movement"
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "partsOrderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ticketId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unitCostCents": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "description": "Amount in integer US cents (zero or more)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actorName": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  }
                },
                "required": [
                  "id",
                  "partId",
                  "partNumber",
                  "type",
                  "quantity",
                  "balanceAfter",
                  "reason",
                  "partsOrderId",
                  "ticketId",
                  "unitCostCents",
                  "actorName",
                  "createdAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the count matched and nothing changed"
          },
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "movement",
          "part"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "stock.ledger",
      "toolName": "stock_ledger",
      "group": "stock",
      "title": "Read the stock ledger",
      "description": "Stock movements, newest first: every receive, adjustment, shipment and return with the quantity, the balance after it, who did it and why. Filter by part, type or date range.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "partId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          },
          "type": {
            "type": "string",
            "enum": [
              "receive",
              "adjust",
              "ship",
              "return"
            ]
          },
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "partsOrderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "receive",
                    "adjust",
                    "ship",
                    "return"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Signed change: positive adds stock, negative removes it"
                },
                "balanceAfter": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand after this movement"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "partsOrderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitCostCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actorName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "partId",
                "partNumber",
                "type",
                "quantity",
                "balanceAfter",
                "reason",
                "partsOrderId",
                "ticketId",
                "unitCostCents",
                "actorName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "stock.low",
      "toolName": "stock_low",
      "group": "stock",
      "title": "List low-stock parts",
      "description": "Parts at or below their reorder point, with stock on hand, the reorder point and the suggested reorder quantity. Parts with no reorder point are never listed.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unit": {
                  "type": "string",
                  "description": "Unit of measure, for example each, ft, set"
                },
                "priceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "priceListDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date of the price list this price comes from"
                },
                "isStale": {
                  "type": "boolean",
                  "description": "True when the price is older than the current price list"
                },
                "fitsModels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Machine models the part fits"
                },
                "onHand": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Stock on hand; changes only through stock movements"
                },
                "reorderPoint": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reorderQuantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "isLow": {
                  "type": "boolean",
                  "description": "True when on hand is at or below the reorder point"
                },
                "binLocation": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "recommendedSpare": {
                  "type": "boolean",
                  "description": "Recommended to keep on the customer's shelf"
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "shortBy": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Reorder point minus on hand"
                }
              },
              "required": [
                "id",
                "partNumber",
                "description",
                "category",
                "unit",
                "priceCents",
                "priceListDate",
                "isStale",
                "fitsModels",
                "onHand",
                "reorderPoint",
                "reorderQuantity",
                "isLow",
                "binLocation",
                "recommendedSpare",
                "active",
                "createdAt",
                "updatedAt",
                "shortBy"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "stock.set_reorder",
      "toolName": "stock_set_reorder",
      "group": "stock",
      "title": "Set a part's reorder point",
      "description": "Set the reorder point and reorder quantity for a part. When stock falls to the reorder point the part shows as low and a low-stock email is sent.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "partId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "partNumber": {
            "type": "string",
            "maxLength": 60
          },
          "reorderPoint": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reorderQuantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "binLocation": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "reorderPoint"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "part": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "partNumber": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unit": {
                "type": "string",
                "description": "Unit of measure, for example each, ft, set"
              },
              "priceCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "priceListDate": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date of the price list this price comes from"
              },
              "isStale": {
                "type": "boolean",
                "description": "True when the price is older than the current price list"
              },
              "fitsModels": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Machine models the part fits"
              },
              "onHand": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Stock on hand; changes only through stock movements"
              },
              "reorderPoint": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "reorderQuantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "isLow": {
                "type": "boolean",
                "description": "True when on hand is at or below the reorder point"
              },
              "binLocation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "recommendedSpare": {
                "type": "boolean",
                "description": "Recommended to keep on the customer's shelf"
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "partNumber",
              "description",
              "category",
              "unit",
              "priceCents",
              "priceListDate",
              "isStale",
              "fitsModels",
              "onHand",
              "reorderPoint",
              "reorderQuantity",
              "isLow",
              "binLocation",
              "recommendedSpare",
              "active",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "part"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.create",
      "toolName": "documents_create",
      "group": "documents",
      "title": "Upload a document",
      "description": "Store a document (signed quote, PO, drawing, manual, inspection report, photo) and link it to records. Two ways to send the bytes: include contentBase64 for files up to 10 MB (the usual way from Claude), or omit it to get an uploadUrl and then PUT the raw file to that URL. The document is pending until its bytes are stored. The account is taken from the first linked record when not given.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          },
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentType": {
            "default": "application/octet-stream",
            "type": "string",
            "maxLength": 100
          },
          "title": {
            "description": "Defaults to the filename",
            "type": "string",
            "maxLength": 200
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "links": {
            "default": [],
            "description": "Records to attach the document to",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entityType": {
                  "type": "string",
                  "enum": [
                    "account",
                    "contact",
                    "site",
                    "order",
                    "machine",
                    "ticket",
                    "warranty_claim",
                    "parts_order",
                    "part",
                    "opportunity",
                    "check_in"
                  ]
                },
                "entityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                }
              },
              "required": [
                "entityType",
                "entityId"
              ]
            }
          },
          "customerVisible": {
            "default": false,
            "description": "Show it to the customer in the portal",
            "type": "boolean"
          },
          "contentBase64": {
            "description": "File bytes, base64 encoded (max 10 MB)",
            "type": "string"
          },
          "source": {
            "default": "upload",
            "type": "string",
            "enum": [
              "upload",
              "email",
              "portal",
              "system",
              "import"
            ]
          }
        },
        "required": [
          "kind",
          "filename"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "stored"
                ],
                "description": "pending until the file bytes are stored"
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerVisible": {
                "type": "boolean",
                "description": "Whether the customer can open it in the portal"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "email",
                  "portal",
                  "system",
                  "import"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityType": {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "parts_order",
                        "part",
                        "opportunity",
                        "check_in"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    }
                  },
                  "required": [
                    "entityType",
                    "entityId"
                  ],
                  "additionalProperties": false
                }
              },
              "uploadedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "status",
              "accountId",
              "customerVisible",
              "source",
              "links",
              "uploadedByName",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "uploadUrl": {
            "description": "PUT the raw bytes here when contentBase64 was not sent; null once stored",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "document",
          "uploadUrl"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.link",
      "toolName": "documents_link",
      "group": "documents",
      "title": "Link a document to a record",
      "description": "Attach an existing document to another record (account, contact, site, order, machine, ticket, warranty claim, parts order, part, opportunity or check-in), or remove a link with unlink true. A document can be linked to many records.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "entityType": {
            "type": "string",
            "enum": [
              "account",
              "contact",
              "site",
              "order",
              "machine",
              "ticket",
              "warranty_claim",
              "parts_order",
              "part",
              "opportunity",
              "check_in"
            ]
          },
          "entityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "unlink": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "documentId",
          "entityType",
          "entityId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "stored"
                ],
                "description": "pending until the file bytes are stored"
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerVisible": {
                "type": "boolean",
                "description": "Whether the customer can open it in the portal"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "email",
                  "portal",
                  "system",
                  "import"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityType": {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "parts_order",
                        "part",
                        "opportunity",
                        "check_in"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    }
                  },
                  "required": [
                    "entityType",
                    "entityId"
                  ],
                  "additionalProperties": false
                }
              },
              "uploadedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "status",
              "accountId",
              "customerVisible",
              "source",
              "links",
              "uploadedByName",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "document"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.update",
      "toolName": "documents_update",
      "group": "documents",
      "title": "Update a document's details",
      "description": "Change a document's title, kind or whether the customer can see it in the portal. The file itself cannot be changed.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "kind": {
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          },
          "customerVisible": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "stored"
                ],
                "description": "pending until the file bytes are stored"
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerVisible": {
                "type": "boolean",
                "description": "Whether the customer can open it in the portal"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "email",
                  "portal",
                  "system",
                  "import"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityType": {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "parts_order",
                        "part",
                        "opportunity",
                        "check_in"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    }
                  },
                  "required": [
                    "entityType",
                    "entityId"
                  ],
                  "additionalProperties": false
                }
              },
              "uploadedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "status",
              "accountId",
              "customerVisible",
              "source",
              "links",
              "uploadedByName",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "document"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.list",
      "toolName": "documents_list",
      "group": "documents",
      "title": "List documents",
      "description": "Documents on a record (entityType and entityId), on a whole account, or of one kind. Newest first.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "entityType": {
            "type": "string",
            "enum": [
              "account",
              "contact",
              "site",
              "order",
              "machine",
              "ticket",
              "warranty_claim",
              "parts_order",
              "part",
              "opportunity",
              "check_in"
            ]
          },
          "entityId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "kind": {
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          },
          "query": {
            "description": "Matches title or filename",
            "type": "string",
            "maxLength": 200
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "stored"
                  ],
                  "description": "pending until the file bytes are stored"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "customerVisible": {
                  "type": "boolean",
                  "description": "Whether the customer can open it in the portal"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "upload",
                    "email",
                    "portal",
                    "system",
                    "import"
                  ]
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "parts_order",
                          "part",
                          "opportunity",
                          "check_in"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      }
                    },
                    "required": [
                      "entityType",
                      "entityId"
                    ],
                    "additionalProperties": false
                  }
                },
                "uploadedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "status",
                "accountId",
                "customerVisible",
                "source",
                "links",
                "uploadedByName",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.get",
      "toolName": "documents_get",
      "group": "documents",
      "title": "Get a document's details",
      "description": "Metadata of one document: kind, filename, size, links and who uploaded it. Use documents.signed_link to open the file.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "kind": {
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          },
          "title": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "stored"
            ],
            "description": "pending until the file bytes are stored"
          },
          "accountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "customerVisible": {
            "type": "boolean",
            "description": "Whether the customer can open it in the portal"
          },
          "source": {
            "type": "string",
            "enum": [
              "upload",
              "email",
              "portal",
              "system",
              "import"
            ]
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entityType": {
                  "type": "string",
                  "enum": [
                    "account",
                    "contact",
                    "site",
                    "order",
                    "machine",
                    "ticket",
                    "warranty_claim",
                    "parts_order",
                    "part",
                    "opportunity",
                    "check_in"
                  ]
                },
                "entityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                }
              },
              "required": [
                "entityType",
                "entityId"
              ],
              "additionalProperties": false
            }
          },
          "uploadedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          }
        },
        "required": [
          "id",
          "kind",
          "title",
          "filename",
          "contentType",
          "sizeBytes",
          "status",
          "accountId",
          "customerVisible",
          "source",
          "links",
          "uploadedByName",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.signed_link",
      "toolName": "documents_signed_link",
      "group": "documents",
      "title": "Get a short-lived link to a document",
      "description": "Issue a signed link that opens or downloads the file for 15 minutes without signing in. Share it only with people who should see the document.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "disposition": {
            "default": "inline",
            "description": "inline opens in the browser, attachment downloads",
            "type": "string",
            "enum": [
              "inline",
              "attachment"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "url": {
            "type": "string",
            "description": "Absolute URL that opens the file without signing in; valid for 15 minutes"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "documentId",
          "url",
          "expiresAt",
          "filename",
          "contentType"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.delete",
      "toolName": "documents_delete",
      "group": "documents",
      "title": "Delete a document",
      "description": "Delete a document and its file. Fails with a conflict if it is the signed quote of an order; replace the signed quote on the order first.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.resolve",
      "toolName": "documents_resolve",
      "group": "documents",
      "title": "Resolve a document to its storage key",
      "description": "Internal: returns the R2 key of a document for the upload and download routes.",
      "kind": "read",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "stored"
                ],
                "description": "pending until the file bytes are stored"
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerVisible": {
                "type": "boolean",
                "description": "Whether the customer can open it in the portal"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "email",
                  "portal",
                  "system",
                  "import"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityType": {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "parts_order",
                        "part",
                        "opportunity",
                        "check_in"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    }
                  },
                  "required": [
                    "entityType",
                    "entityId"
                  ],
                  "additionalProperties": false
                }
              },
              "uploadedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "status",
              "accountId",
              "customerVisible",
              "source",
              "links",
              "uploadedByName",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "r2Key": {
            "type": "string"
          }
        },
        "required": [
          "document",
          "r2Key"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "documents.finalize",
      "toolName": "documents_finalize",
      "group": "documents",
      "title": "Mark a document's bytes as stored",
      "description": "Internal: called by the upload route after the file is in R2. Sets size, checksum and status stored. Fails with conflict when the document already has its file, so only one of two concurrent uploads wins.",
      "kind": "write",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "contentType": {
            "type": "string",
            "maxLength": 100
          },
          "r2Key": {
            "description": "Where the upload wrote the bytes, when not the document's own key",
            "type": "string",
            "maxLength": 1000
          },
          "uploadedByKind": {
            "description": "Who uploaded, for the audit row",
            "type": "string",
            "enum": [
              "staff",
              "customer",
              "agent",
              "system"
            ]
          }
        },
        "required": [
          "id",
          "sizeBytes"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "stored"
                ],
                "description": "pending until the file bytes are stored"
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "customerVisible": {
                "type": "boolean",
                "description": "Whether the customer can open it in the portal"
              },
              "source": {
                "type": "string",
                "enum": [
                  "upload",
                  "email",
                  "portal",
                  "system",
                  "import"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityType": {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "parts_order",
                        "part",
                        "opportunity",
                        "check_in"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    }
                  },
                  "required": [
                    "entityType",
                    "entityId"
                  ],
                  "additionalProperties": false
                }
              },
              "uploadedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "status",
              "accountId",
              "customerVisible",
              "source",
              "links",
              "uploadedByName",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "document"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.log",
      "toolName": "activities_log",
      "group": "activities",
      "title": "Log a call, text, visit or note",
      "description": "Add an entry to an account's communication log: a call, text, visit, note or a manually entered email. It can also be tied to a contact, order, machine or ticket. Calls, emails, texts and visits update the account's last-contacted date. For emails imported from Gmail use activities.log_email, which prevents duplicates.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "text",
              "visit",
              "note"
            ]
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "body": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 50000
              },
              {
                "type": "null"
              }
            ]
          },
          "direction": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "outbound",
                  "inbound"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "occurredAt": {
            "description": "Defaults to now",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 1440
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accountId",
          "type",
          "subject"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "activity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "call",
                  "email",
                  "text",
                  "visit",
                  "note",
                  "system"
                ]
              },
              "direction": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "body": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "externalRef": {
                "description": "Gmail message id for imported emails; unique",
                "type": [
                  "string",
                  "null"
                ]
              },
              "externalThreadId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fromAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "toAddresses": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "durationMinutes": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "documentIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "description": "Attachments stored as documents"
              },
              "loggedByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "direction",
              "subject",
              "body",
              "occurredAt",
              "accountId",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "externalRef",
              "externalThreadId",
              "fromAddress",
              "toAddresses",
              "durationMinutes",
              "documentIds",
              "loggedByName",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "activity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.log_email",
      "toolName": "activities_log_email",
      "group": "activities",
      "title": "File a Gmail email on an account",
      "description": "Store one email from a staff mailbox on the right account, with its attachments saved as documents. Idempotent: an email with the same Gmail message id, or the same RFC 822 Message-ID (when given), is stored once, so the same email read from Gmail and forwarded to crm@ is filed once; calling again returns the existing entry with created false. If accountId is not given the account is matched from the sender and recipient addresses against contact emails; when no account matches the call fails with not_found and nothing is stored.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "gmailMessageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Gmail message id; the idempotency key"
          },
          "rfc822MessageId": {
            "description": "The email's Message-ID header, for example <abc@mail.example.com>; a second key: an email with the same Message-ID is stored once",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 998
              },
              {
                "type": "null"
              }
            ]
          },
          "gmailThreadId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "accountId": {
            "description": "Skip matching and file on this account",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 320,
            "description": "Sender address"
          },
          "to": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 320
            }
          },
          "cc": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 320
            }
          },
          "subject": {
            "default": "(no subject)",
            "type": "string",
            "maxLength": 500
          },
          "bodyText": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200000
              },
              {
                "type": "null"
              }
            ]
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "direction": {
            "description": "Defaults to outbound when the sender is a staff address",
            "type": "string",
            "enum": [
              "outbound",
              "inbound"
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachments": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255
                },
                "contentType": {
                  "default": "application/pdf",
                  "type": "string",
                  "maxLength": 100
                },
                "contentBase64": {
                  "type": "string",
                  "minLength": 1,
                  "description": "File bytes, base64 encoded (max 10 MB)"
                }
              },
              "required": [
                "filename",
                "contentBase64"
              ]
            }
          },
          "attachmentDocumentIds": {
            "default": [],
            "description": "Documents already uploaded for this email",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          }
        },
        "required": [
          "gmailMessageId",
          "from",
          "sentAt"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "activity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "call",
                  "email",
                  "text",
                  "visit",
                  "note",
                  "system"
                ]
              },
              "direction": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "body": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "externalRef": {
                "description": "Gmail message id for imported emails; unique",
                "type": [
                  "string",
                  "null"
                ]
              },
              "externalThreadId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fromAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "toAddresses": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "durationMinutes": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "documentIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "description": "Attachments stored as documents"
              },
              "loggedByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "direction",
              "subject",
              "body",
              "occurredAt",
              "accountId",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "externalRef",
              "externalThreadId",
              "fromAddress",
              "toAddresses",
              "durationMinutes",
              "documentIds",
              "loggedByName",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean",
            "description": "False when this Gmail message id was already stored"
          },
          "matchedBy": {
            "type": "string",
            "enum": [
              "account_id",
              "contact_email",
              "existing"
            ]
          },
          "matchedContactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          }
        },
        "required": [
          "activity",
          "created",
          "matchedBy",
          "matchedContactId",
          "documentIds"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.match_email",
      "toolName": "activities_match_email",
      "group": "activities",
      "title": "Find the account for an email",
      "description": "Given the addresses on an email, return the accounts and contacts they belong to and whether the Gmail message id is already stored. Use it to decide where an email should be filed before calling activities.log_email.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "addresses": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 320
            }
          },
          "gmailMessageId": {
            "type": "string",
            "maxLength": 200
          },
          "rfc822MessageId": {
            "description": "The email's Message-ID header; also checked for alreadyStored",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 998
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "addresses"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "alreadyStored": {
            "type": "boolean"
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "contactId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactName": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "openOrderIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  }
                }
              },
              "required": [
                "accountId",
                "accountName",
                "contactId",
                "contactName",
                "email",
                "openOrderIds"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "alreadyStored",
          "matches"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.list",
      "toolName": "activities_list",
      "group": "activities",
      "title": "Read the communication log",
      "description": "Activity timeline entries, newest first, for an account, contact, order, machine or ticket, optionally of one type or within a date range.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "text",
              "visit",
              "note",
              "system"
            ]
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "query": {
            "description": "Matches subject or body",
            "type": "string",
            "maxLength": 200
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "call",
                    "email",
                    "text",
                    "visit",
                    "note",
                    "system"
                  ]
                },
                "direction": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "outbound",
                        "inbound"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "subject": {
                  "type": "string"
                },
                "body": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "externalRef": {
                  "description": "Gmail message id for imported emails; unique",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "externalThreadId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fromAddress": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toAddresses": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "durationMinutes": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "description": "Attachments stored as documents"
                },
                "loggedByName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "contactName": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "type",
                "direction",
                "subject",
                "body",
                "occurredAt",
                "accountId",
                "contactId",
                "orderId",
                "machineId",
                "ticketId",
                "externalRef",
                "externalThreadId",
                "fromAddress",
                "toAddresses",
                "durationMinutes",
                "documentIds",
                "loggedByName",
                "createdAt",
                "accountName",
                "contactName"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.update",
      "toolName": "activities_update",
      "group": "activities",
      "title": "Edit a log entry",
      "description": "Correct the subject, body, time, links or duration of a logged activity. Imported emails keep their Gmail message id.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "body": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 50000
              },
              {
                "type": "null"
              }
            ]
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 1440
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "activity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "call",
                  "email",
                  "text",
                  "visit",
                  "note",
                  "system"
                ]
              },
              "direction": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subject": {
                "type": "string"
              },
              "body": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "externalRef": {
                "description": "Gmail message id for imported emails; unique",
                "type": [
                  "string",
                  "null"
                ]
              },
              "externalThreadId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fromAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "toAddresses": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "durationMinutes": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "documentIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "description": "Attachments stored as documents"
              },
              "loggedByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "direction",
              "subject",
              "body",
              "occurredAt",
              "accountId",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "externalRef",
              "externalThreadId",
              "fromAddress",
              "toAddresses",
              "durationMinutes",
              "documentIds",
              "loggedByName",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "activity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "activities.delete",
      "toolName": "activities_delete",
      "group": "activities",
      "title": "Delete a log entry",
      "description": "Remove an activity logged by mistake. The account's last-contacted date is recalculated.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.list",
      "toolName": "tasks_list",
      "group": "tasks",
      "title": "List tasks and appointments",
      "description": "Tasks, calls, visits, deliveries, commissioning and service appointments with filters for assignee, account, status, type and due-date range. overdueOnly returns open items due before today.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "mine": {
            "default": false,
            "description": "Only items assigned to the caller",
            "type": "boolean"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "ticketId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "done",
              "cancelled"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "task",
              "call",
              "visit",
              "delivery",
              "commissioning",
              "service",
              "check_in"
            ]
          },
          "dueFrom": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "dueTo": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "overdueOnly": {
            "default": false,
            "type": "boolean"
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "task",
                    "call",
                    "visit",
                    "delivery",
                    "commissioning",
                    "service",
                    "check_in"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "open",
                    "done",
                    "cancelled"
                  ]
                },
                "dueOn": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Day the task is due or the appointment happens"
                },
                "startsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Start time for timed appointments; null for all-day items"
                },
                "endsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "location": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "assignedToUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "assignedToName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "accountName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "checkInId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isOverdue": {
                  "type": "boolean",
                  "description": "Open and due before today"
                },
                "googleEventId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "syncState": {
                  "type": "string",
                  "enum": [
                    "not_synced",
                    "pending",
                    "synced",
                    "error"
                  ]
                },
                "syncedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "syncError": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "completedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "type",
                "title",
                "notes",
                "status",
                "dueOn",
                "startsAt",
                "endsAt",
                "location",
                "assignedToUserId",
                "assignedToName",
                "accountId",
                "accountName",
                "contactId",
                "orderId",
                "machineId",
                "ticketId",
                "siteId",
                "checkInId",
                "isOverdue",
                "googleEventId",
                "syncState",
                "syncedAt",
                "syncError",
                "completedAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.get",
      "toolName": "tasks_get",
      "group": "tasks",
      "title": "Get a task or appointment",
      "description": "One task, call, visit, delivery or appointment with its links, notes, assignee and Google Calendar sync state.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "task": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "task",
                  "call",
                  "visit",
                  "delivery",
                  "commissioning",
                  "service",
                  "check_in"
                ]
              },
              "title": {
                "type": "string"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "done",
                  "cancelled"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Day the task is due or the appointment happens"
              },
              "startsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Start time for timed appointments; null for all-day items"
              },
              "endsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "location": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "assignedToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "accountName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "checkInId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isOverdue": {
                "type": "boolean",
                "description": "Open and due before today"
              },
              "googleEventId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "syncState": {
                "type": "string",
                "enum": [
                  "not_synced",
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "syncedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "syncError": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "title",
              "notes",
              "status",
              "dueOn",
              "startsAt",
              "endsAt",
              "location",
              "assignedToUserId",
              "assignedToName",
              "accountId",
              "accountName",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "siteId",
              "checkInId",
              "isOverdue",
              "googleEventId",
              "syncState",
              "syncedAt",
              "syncError",
              "completedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "task"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.create",
      "toolName": "tasks_create",
      "group": "tasks",
      "title": "Create a task or appointment",
      "description": "Create a task, call, visit, delivery, commissioning or service appointment, due on a day and optionally with a start and end time. It can be tied to an account, contact, order, machine, ticket and site. New items are marked pending for Google Calendar sync.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "type": {
            "default": "task",
            "type": "string",
            "enum": [
              "task",
              "call",
              "visit",
              "delivery",
              "commissioning",
              "service",
              "check_in"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "dueOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "endsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "location": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "assignedToUserId": {
            "description": "Defaults to the caller",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "title",
          "dueOn"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "task": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "task",
                  "call",
                  "visit",
                  "delivery",
                  "commissioning",
                  "service",
                  "check_in"
                ]
              },
              "title": {
                "type": "string"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "done",
                  "cancelled"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Day the task is due or the appointment happens"
              },
              "startsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Start time for timed appointments; null for all-day items"
              },
              "endsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "location": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "assignedToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "accountName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "checkInId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isOverdue": {
                "type": "boolean",
                "description": "Open and due before today"
              },
              "googleEventId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "syncState": {
                "type": "string",
                "enum": [
                  "not_synced",
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "syncedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "syncError": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "title",
              "notes",
              "status",
              "dueOn",
              "startsAt",
              "endsAt",
              "location",
              "assignedToUserId",
              "assignedToName",
              "accountId",
              "accountName",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "siteId",
              "checkInId",
              "isOverdue",
              "googleEventId",
              "syncState",
              "syncedAt",
              "syncError",
              "completedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "task"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.update",
      "toolName": "tasks_update",
      "group": "tasks",
      "title": "Update a task or appointment",
      "description": "Change a task's title, notes, type, dates, times, location, assignee, links or status. Changes are marked pending for Google Calendar sync.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "task",
              "call",
              "visit",
              "delivery",
              "commissioning",
              "service",
              "check_in"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "done",
              "cancelled"
            ]
          },
          "dueOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "endsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "location": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "assignedToUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "task": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "task",
                  "call",
                  "visit",
                  "delivery",
                  "commissioning",
                  "service",
                  "check_in"
                ]
              },
              "title": {
                "type": "string"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "done",
                  "cancelled"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Day the task is due or the appointment happens"
              },
              "startsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Start time for timed appointments; null for all-day items"
              },
              "endsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "location": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "assignedToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "accountName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "checkInId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isOverdue": {
                "type": "boolean",
                "description": "Open and due before today"
              },
              "googleEventId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "syncState": {
                "type": "string",
                "enum": [
                  "not_synced",
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "syncedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "syncError": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "title",
              "notes",
              "status",
              "dueOn",
              "startsAt",
              "endsAt",
              "location",
              "assignedToUserId",
              "assignedToName",
              "accountId",
              "accountName",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "siteId",
              "checkInId",
              "isOverdue",
              "googleEventId",
              "syncState",
              "syncedAt",
              "syncError",
              "completedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "task"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.complete",
      "toolName": "tasks_complete",
      "group": "tasks",
      "title": "Complete or reopen a task",
      "description": "Mark a task done (or reopen it with done false). Completing a check-in task does not complete the check-in; use checkins.complete to record the outcome.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "done": {
            "default": true,
            "type": "boolean"
          },
          "completedAt": {
            "description": "When it was done, for a change recorded later (for example offline); defaults to now. Not in the future.",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "task": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "type": {
                "type": "string",
                "enum": [
                  "task",
                  "call",
                  "visit",
                  "delivery",
                  "commissioning",
                  "service",
                  "check_in"
                ]
              },
              "title": {
                "type": "string"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "done",
                  "cancelled"
                ]
              },
              "dueOn": {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Day the task is due or the appointment happens"
              },
              "startsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Start time for timed appointments; null for all-day items"
              },
              "endsAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "location": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "assignedToUserId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "assignedToName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "accountName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ticketId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siteId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "checkInId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isOverdue": {
                "type": "boolean",
                "description": "Open and due before today"
              },
              "googleEventId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "syncState": {
                "type": "string",
                "enum": [
                  "not_synced",
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "syncedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "syncError": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "type",
              "title",
              "notes",
              "status",
              "dueOn",
              "startsAt",
              "endsAt",
              "location",
              "assignedToUserId",
              "assignedToName",
              "accountId",
              "accountName",
              "contactId",
              "orderId",
              "machineId",
              "ticketId",
              "siteId",
              "checkInId",
              "isOverdue",
              "googleEventId",
              "syncState",
              "syncedAt",
              "syncError",
              "completedAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "task"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "tasks.delete",
      "toolName": "tasks_delete",
      "group": "tasks",
      "title": "Delete a task",
      "description": "Delete a task or appointment. If it was synced to Google Calendar the event is queued for removal.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "agenda.get",
      "toolName": "agenda_get",
      "group": "agenda",
      "title": "Get the agenda",
      "description": "What is coming up, grouped by day: tasks, calls, visits, deliveries, commissioning and service appointments, order ship dates, warranty end dates, check-ins, preventive maintenance due and service contract renewals. Defaults to the 14 days starting today. Overdue open tasks are returned separately. Includes the Google Calendar sync state.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "description": "First day; defaults to today",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "to": {
            "description": "Last day; defaults to 13 days after from",
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "mine": {
            "default": false,
            "description": "Only tasks assigned to the caller (dated records such as warranty ends are always included)",
            "type": "boolean"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "kinds": {
            "description": "Limit to these kinds of item",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "task",
                "ship_date",
                "delivery",
                "warranty_end",
                "check_in",
                "service_due",
                "contract_renewal"
              ]
            }
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "today": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "isToday": {
                  "type": "boolean"
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "task",
                          "ship_date",
                          "delivery",
                          "warranty_end",
                          "check_in",
                          "service_due",
                          "contract_renewal"
                        ]
                      },
                      "date": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      "title": {
                        "type": "string"
                      },
                      "subtitle": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "startsAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                            "description": "UTC timestamp, ISO 8601 with Z"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "entityType": {
                        "type": "string",
                        "enum": [
                          "account",
                          "contact",
                          "site",
                          "order",
                          "product",
                          "machine",
                          "ticket",
                          "warranty_claim",
                          "part",
                          "parts_order",
                          "document",
                          "activity",
                          "task",
                          "check_in",
                          "opportunity",
                          "service_plan",
                          "service_contract",
                          "training_record",
                          "import_run",
                          "user",
                          "portal_invite",
                          "customer_user",
                          "calendar_feed",
                          "stock_movement",
                          "email"
                        ]
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      "accountId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "accountName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "taskId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "Record id (UUID)"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "taskType": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "task",
                              "call",
                              "visit",
                              "delivery",
                              "commissioning",
                              "service",
                              "check_in"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "done": {
                        "type": "boolean"
                      },
                      "overdue": {
                        "type": "boolean"
                      },
                      "syncState": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "not_synced",
                              "pending",
                              "synced",
                              "error"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "date",
                      "title",
                      "subtitle",
                      "startsAt",
                      "entityType",
                      "entityId",
                      "accountId",
                      "accountName",
                      "taskId",
                      "taskType",
                      "done",
                      "overdue",
                      "syncState"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "date",
                "isToday",
                "items"
              ],
              "additionalProperties": false
            },
            "description": "Only days that have items, in date order"
          },
          "overdue": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "task",
                    "ship_date",
                    "delivery",
                    "warranty_end",
                    "check_in",
                    "service_due",
                    "contract_renewal"
                  ]
                },
                "date": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                "title": {
                  "type": "string"
                },
                "subtitle": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "startsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entityType": {
                  "type": "string",
                  "enum": [
                    "account",
                    "contact",
                    "site",
                    "order",
                    "product",
                    "machine",
                    "ticket",
                    "warranty_claim",
                    "part",
                    "parts_order",
                    "document",
                    "activity",
                    "task",
                    "check_in",
                    "opportunity",
                    "service_plan",
                    "service_contract",
                    "training_record",
                    "import_run",
                    "user",
                    "portal_invite",
                    "customer_user",
                    "calendar_feed",
                    "stock_movement",
                    "email"
                  ]
                },
                "entityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "accountName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taskId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taskType": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "task",
                        "call",
                        "visit",
                        "delivery",
                        "commissioning",
                        "service",
                        "check_in"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "done": {
                  "type": "boolean"
                },
                "overdue": {
                  "type": "boolean"
                },
                "syncState": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "not_synced",
                        "pending",
                        "synced",
                        "error"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "kind",
                "date",
                "title",
                "subtitle",
                "startsAt",
                "entityType",
                "entityId",
                "accountId",
                "accountName",
                "taskId",
                "taskType",
                "done",
                "overdue",
                "syncState"
              ],
              "additionalProperties": false
            },
            "description": "Open tasks due before the range"
          },
          "sync": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "not_synced",
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "pendingCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "errorCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "lastSyncedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "pendingCount",
              "errorCount",
              "lastSyncedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "from",
          "to",
          "today",
          "days",
          "overdue",
          "sync"
        ],
        "additionalProperties": false
      },
      "view": "agenda"
    },
    {
      "name": "calendar.sync_state",
      "toolName": "calendar_sync_state",
      "group": "calendar",
      "title": "Get Google Calendar sync state",
      "description": "How the CRM's tasks and appointments stand against Google Calendar: how many are synced, pending a push, or in error, when the last sync ran, and whether a direct Google connection is configured. Without a direct connection, sync is done through Claude's Google Calendar connector using calendar.pending and calendar.record_sync.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "not_synced",
              "pending",
              "synced",
              "error"
            ]
          },
          "connected": {
            "type": "boolean",
            "description": "True when the server holds Google Calendar credentials and syncs on its own"
          },
          "syncedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pendingCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errorCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastSyncedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              {
                "type": "null"
              }
            ]
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taskId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "title": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "taskId",
                "title",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "state",
          "connected",
          "syncedCount",
          "pendingCount",
          "errorCount",
          "lastSyncedAt",
          "errors"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.pending",
      "toolName": "calendar_pending",
      "group": "calendar",
      "title": "List tasks waiting to sync to Google Calendar",
      "description": "Tasks and appointments that were created, changed, completed or deleted since they were last pushed to Google Calendar. For each one, action says what to do in Google Calendar (create, update or delete the event). After doing it, call calendar.record_sync with the Google event id.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assignedToUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string",
                  "enum": [
                    "create",
                    "update",
                    "delete"
                  ]
                },
                "taskId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "googleEventId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "task": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "task",
                            "call",
                            "visit",
                            "delivery",
                            "commissioning",
                            "service",
                            "check_in"
                          ]
                        },
                        "title": {
                          "type": "string"
                        },
                        "notes": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "open",
                            "done",
                            "cancelled"
                          ]
                        },
                        "dueOn": {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Day the task is due or the appointment happens"
                        },
                        "startsAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                              "description": "UTC timestamp, ISO 8601 with Z"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Start time for timed appointments; null for all-day items"
                        },
                        "endsAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                              "description": "UTC timestamp, ISO 8601 with Z"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "location": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "assignedToUserId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "assignedToName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "accountId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "accountName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contactId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "orderId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "machineId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "ticketId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "siteId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "checkInId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "isOverdue": {
                          "type": "boolean",
                          "description": "Open and due before today"
                        },
                        "googleEventId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "syncState": {
                          "type": "string",
                          "enum": [
                            "not_synced",
                            "pending",
                            "synced",
                            "error"
                          ]
                        },
                        "syncedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                              "description": "UTC timestamp, ISO 8601 with Z"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "syncError": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "completedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                              "description": "UTC timestamp, ISO 8601 with Z"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "title",
                        "notes",
                        "status",
                        "dueOn",
                        "startsAt",
                        "endsAt",
                        "location",
                        "assignedToUserId",
                        "assignedToName",
                        "accountId",
                        "accountName",
                        "contactId",
                        "orderId",
                        "machineId",
                        "ticketId",
                        "siteId",
                        "checkInId",
                        "isOverdue",
                        "googleEventId",
                        "syncState",
                        "syncedAt",
                        "syncError",
                        "completedAt",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null when the task was deleted"
                },
                "event": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "summary": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "location": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "allDay": {
                          "type": "boolean"
                        },
                        "start": {
                          "type": "string",
                          "description": "Date (all-day) or UTC timestamp"
                        },
                        "end": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "summary",
                        "description",
                        "location",
                        "allDay",
                        "start",
                        "end"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Ready-made Google Calendar event fields"
                }
              },
              "required": [
                "action",
                "taskId",
                "googleEventId",
                "task",
                "event"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.record_sync",
      "toolName": "calendar_record_sync",
      "group": "calendar",
      "title": "Record a Google Calendar sync result",
      "description": "After creating, updating or deleting a Google Calendar event for a task, record the outcome: the Google event id on success, or an error message. Marks the task synced (or error).",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "results": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taskId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "googleEventId": {
                  "description": "The event created or updated; with deleted, the event that was removed (as calendar.pending gave it)",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 300
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "googleCalendarId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 300
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "deleted": {
                  "default": false,
                  "description": "The Google event was removed. Give its googleEventId too.",
                  "type": "boolean"
                },
                "error": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 1000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "taskId"
              ]
            }
          }
        },
        "required": [
          "results"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "synced": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errors": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "synced",
          "errors"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.import_events",
      "toolName": "calendar_import_events",
      "group": "calendar",
      "title": "Bring Google Calendar changes into the CRM",
      "description": "The inbound half of two-way sync. Give events read from Google Calendar; events already linked to a task (by Google event id) update that task's title, date, time and location, cancelled events cancel the task, and events not yet linked become new tasks when createMissing is true.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "events": {
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "googleEventId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "googleCalendarId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 300
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "summary": {
                  "type": "string",
                  "maxLength": 300
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 20000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "location": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 500
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "startDate": {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                  "description": "Day of the event"
                },
                "startsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "endsAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cancelled": {
                  "default": false,
                  "type": "boolean"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "googleEventId",
                "summary",
                "startDate"
              ]
            }
          },
          "createMissing": {
            "default": false,
            "type": "boolean"
          },
          "defaultType": {
            "default": "visit",
            "type": "string",
            "enum": [
              "task",
              "call",
              "visit",
              "delivery",
              "commissioning",
              "service",
              "check_in"
            ]
          },
          "assignedToUserId": {
            "description": "Owner for new tasks; defaults to the caller",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": [
          "events"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "updated": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "cancelled": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unchanged": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "taskIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          }
        },
        "required": [
          "created",
          "updated",
          "cancelled",
          "unchanged",
          "taskIds"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.sync",
      "toolName": "calendar_sync",
      "group": "calendar",
      "title": "Sync with Google Calendar now",
      "description": "Run the two-way Google Calendar sync for one staff user (the caller by default) using the server's direct Google connection: pulls events changed in Google into their linked tasks, then pushes tasks that were created, changed or deleted in the CRM. Returns connected false, and changes nothing, when that user has not connected Google Calendar; in that case sync through Claude's connector with calendar.pending and calendar.record_sync.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "userId": {
            "description": "Staff user to sync; defaults to the caller",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "createMissing": {
            "default": false,
            "description": "Also turn Google events that are not linked to a task into new tasks",
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "pushed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Tasks created or updated in Google Calendar"
          },
          "deleted": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Google events removed"
          },
          "pulled": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Tasks created, updated or cancelled from Google changes"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taskId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "taskId",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "connected",
          "pushed",
          "deleted",
          "pulled",
          "errors"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.feed_get",
      "toolName": "calendar_feed_get",
      "group": "calendar",
      "title": "Get my private iCal feed",
      "description": "The caller's private iCal subscription URL, creating it on first use. Subscribing in Google Calendar, Apple Calendar or Outlook shows tasks, visits, ship dates and warranty ends read-only. Treat the URL like a password.",
      "kind": "write",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "feed": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "userId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "url": {
                "type": "string",
                "description": "Private iCal subscription URL; treat it like a password"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "lastAccessedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "userId",
              "url",
              "createdAt",
              "lastAccessedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "feed",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.feed_rotate",
      "toolName": "calendar_feed_rotate",
      "group": "calendar",
      "title": "Replace my iCal feed URL",
      "description": "Issue a new private iCal URL for the caller and stop the old one working. Use it if the URL was shared by mistake.",
      "kind": "write",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "feed": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "userId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "url": {
                "type": "string",
                "description": "Private iCal subscription URL; treat it like a password"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "lastAccessedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "userId",
              "url",
              "createdAt",
              "lastAccessedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "feed"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "calendar.feed_render",
      "toolName": "calendar_feed_render",
      "group": "calendar",
      "title": "Render an iCal feed",
      "description": "Internal: returns the iCalendar text for a feed token. Used by the public feed route.",
      "kind": "read",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "token"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ics": {
            "type": "string"
          },
          "eventCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "ics",
          "eventCount"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "opportunities.list",
      "toolName": "opportunities_list",
      "group": "opportunities",
      "title": "List expansion opportunities",
      "description": "Add-on equipment opportunities noticed while serving existing customers (a second silo, a feeder belt, a mixer), with filters for account and status.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "handed_to_sales",
              "won",
              "lost"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "productName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "machineId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Machine that prompted the add-on, if any"
                },
                "estimatedValueCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "open",
                    "handed_to_sales",
                    "won",
                    "lost"
                  ]
                },
                "handedToSalesOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "salesContact": {
                  "description": "Sales person the opportunity was handed to",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "accountName",
                "title",
                "description",
                "productId",
                "productName",
                "machineId",
                "estimatedValueCents",
                "status",
                "handedToSalesOn",
                "salesContact",
                "notes",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "openValueCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "openValueCents"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "opportunities.create",
      "toolName": "opportunities_create",
      "group": "opportunities",
      "title": "Log an expansion opportunity",
      "description": "Record that a customer is interested in add-on equipment, optionally pointing at a product from the price list (which fills the estimated value) and the machine that prompted it.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "estimatedValueCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "accountId",
          "title"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "opportunity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "productName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Machine that prompted the add-on, if any"
              },
              "estimatedValueCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "handed_to_sales",
                  "won",
                  "lost"
                ]
              },
              "handedToSalesOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "salesContact": {
                "description": "Sales person the opportunity was handed to",
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "title",
              "description",
              "productId",
              "productName",
              "machineId",
              "estimatedValueCents",
              "status",
              "handedToSalesOn",
              "salesContact",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "opportunity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "opportunities.update",
      "toolName": "opportunities_update",
      "group": "opportunities",
      "title": "Update an expansion opportunity",
      "description": "Change an opportunity's details or mark it won or lost.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "estimatedValueCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "handed_to_sales",
              "won",
              "lost"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "opportunity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "productName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Machine that prompted the add-on, if any"
              },
              "estimatedValueCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "handed_to_sales",
                  "won",
                  "lost"
                ]
              },
              "handedToSalesOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "salesContact": {
                "description": "Sales person the opportunity was handed to",
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "title",
              "description",
              "productId",
              "productName",
              "machineId",
              "estimatedValueCents",
              "status",
              "handedToSalesOn",
              "salesContact",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "opportunity"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "opportunities.hand_to_sales",
      "toolName": "opportunities_hand_to_sales",
      "group": "opportunities",
      "title": "Hand an opportunity to sales",
      "description": "Pass an opportunity to the sales team: sets status handed_to_sales with today's date and the sales person, logs a note on the account timeline, and emails the sales person a summary when an email address is given.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "salesContact": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Name or email of the sales person"
          },
          "salesEmail": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "handedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "salesContact"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "opportunity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "productId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "productName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "machineId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Machine that prompted the add-on, if any"
              },
              "estimatedValueCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "open",
                  "handed_to_sales",
                  "won",
                  "lost"
                ]
              },
              "handedToSalesOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "salesContact": {
                "description": "Sales person the opportunity was handed to",
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "title",
              "description",
              "productId",
              "productName",
              "machineId",
              "estimatedValueCents",
              "status",
              "handedToSalesOn",
              "salesContact",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "emailQueued": {
            "type": "boolean"
          }
        },
        "required": [
          "opportunity",
          "emailQueued"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.dry_run",
      "toolName": "import_dry_run",
      "group": "import",
      "title": "Preview an import",
      "description": "Step one of an import. Give rows read from a Google Sheet, a Drive file, a HubSpot export or a CSV (an array of objects keyed by column name) and the entity they hold: accounts, contacts, sites, products, parts or machines. Columns are mapped to fields automatically by name unless you give a mapping. Nothing is written except the preview itself. Each row comes back as create, update, skip_duplicate or error, with duplicate checks on normalized company name, contact email, SKU, part number and serial number. Review the preview, then call import.apply with the run id.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "entity": {
            "type": "string",
            "enum": [
              "accounts",
              "contacts",
              "sites",
              "products",
              "parts",
              "machines"
            ]
          },
          "source": {
            "default": "google_sheet",
            "type": "string",
            "enum": [
              "google_sheet",
              "google_drive",
              "csv",
              "hubspot_export",
              "pdf_extract"
            ]
          },
          "sourceName": {
            "description": "File or sheet name, for the record",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "rows": {
            "minItems": 1,
            "maxItems": 5000,
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "mapping": {
            "description": "Source column name to target field name; unmapped columns are ignored",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "onDuplicate": {
            "default": "skip",
            "description": "What to do with rows that match an existing record",
            "type": "string",
            "enum": [
              "skip",
              "update"
            ]
          },
          "defaults": {
            "description": "Values applied to every row when the field is empty, for example priceListDate",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "entity",
          "rows"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "entity": {
                "type": "string",
                "enum": [
                  "accounts",
                  "contacts",
                  "sites",
                  "products",
                  "parts",
                  "machines"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "google_sheet",
                  "google_drive",
                  "csv",
                  "hubspot_export",
                  "pdf_extract"
                ]
              },
              "sourceName": {
                "description": "File or sheet name",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "dry_run",
                  "applying",
                  "applied",
                  "failed"
                ]
              },
              "mapping": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Source column name to target field name"
              },
              "totalRows": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "updateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "duplicateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "errorCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createdByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "appliedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entity",
              "source",
              "sourceName",
              "status",
              "mapping",
              "totalRows",
              "createCount",
              "updateCount",
              "duplicateCount",
              "errorCount",
              "createdByName",
              "createdAt",
              "appliedAt"
            ],
            "additionalProperties": false
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Column names found in the source"
          },
          "targetFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Fields this entity accepts"
          },
          "unmappedColumns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missingRequiredFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Required fields no column is mapped to"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rowNumber": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "1-based row number in the source, not counting the header"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "create",
                    "update",
                    "skip_duplicate",
                    "error"
                  ]
                },
                "data": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {},
                  "description": "Mapped values for this row"
                },
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "duplicateOf": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Existing record this row matches"
                }
              },
              "required": [
                "rowNumber",
                "action",
                "data",
                "errors",
                "duplicateOf"
              ],
              "additionalProperties": false
            },
            "description": "Per-row result (first 200 rows)"
          },
          "rowsTruncated": {
            "type": "boolean"
          }
        },
        "required": [
          "run",
          "columns",
          "targetFields",
          "unmappedColumns",
          "missingRequiredFields",
          "rows",
          "rowsTruncated"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.apply",
      "toolName": "import_apply",
      "group": "import",
      "title": "Apply a previewed import",
      "description": "Step two of an import: write the rows of a dry run to the CRM. Rows marked error are skipped. Duplicates are re-checked at apply time. Each run can be applied once. Returns the final counts and the ids created.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "confirm": {
            "type": "boolean",
            "const": true,
            "description": "Must be true: confirms the preview was reviewed"
          }
        },
        "required": [
          "runId",
          "confirm"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "entity": {
                "type": "string",
                "enum": [
                  "accounts",
                  "contacts",
                  "sites",
                  "products",
                  "parts",
                  "machines"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "google_sheet",
                  "google_drive",
                  "csv",
                  "hubspot_export",
                  "pdf_extract"
                ]
              },
              "sourceName": {
                "description": "File or sheet name",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "dry_run",
                  "applying",
                  "applied",
                  "failed"
                ]
              },
              "mapping": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Source column name to target field name"
              },
              "totalRows": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "updateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "duplicateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "errorCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createdByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "appliedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entity",
              "source",
              "sourceName",
              "status",
              "mapping",
              "totalRows",
              "createCount",
              "updateCount",
              "duplicateCount",
              "errorCount",
              "createdByName",
              "createdAt",
              "appliedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "updated": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "skipped": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rowNumber": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "rowNumber",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "createdIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            }
          }
        },
        "required": [
          "run",
          "created",
          "updated",
          "skipped",
          "errors",
          "createdIds"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.get_run",
      "toolName": "import_get_run",
      "group": "import",
      "title": "Get an import run",
      "description": "Read an import run and its per-row results again, optionally only rows with one action (for example error).",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "skip_duplicate",
              "error"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "runId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "entity": {
                "type": "string",
                "enum": [
                  "accounts",
                  "contacts",
                  "sites",
                  "products",
                  "parts",
                  "machines"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "google_sheet",
                  "google_drive",
                  "csv",
                  "hubspot_export",
                  "pdf_extract"
                ]
              },
              "sourceName": {
                "description": "File or sheet name",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "dry_run",
                  "applying",
                  "applied",
                  "failed"
                ]
              },
              "mapping": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Source column name to target field name"
              },
              "totalRows": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "updateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "duplicateCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "errorCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "createdByName": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "appliedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entity",
              "source",
              "sourceName",
              "status",
              "mapping",
              "totalRows",
              "createCount",
              "updateCount",
              "duplicateCount",
              "errorCount",
              "createdByName",
              "createdAt",
              "appliedAt"
            ],
            "additionalProperties": false
          },
          "rows": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "rowNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "1-based row number in the source, not counting the header"
                    },
                    "action": {
                      "type": "string",
                      "enum": [
                        "create",
                        "update",
                        "skip_duplicate",
                        "error"
                      ]
                    },
                    "data": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {},
                      "description": "Mapped values for this row"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duplicateOf": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "description": "Record id (UUID)"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Existing record this row matches"
                    }
                  },
                  "required": [
                    "rowNumber",
                    "action",
                    "data",
                    "errors",
                    "duplicateOf"
                  ],
                  "additionalProperties": false
                }
              },
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Total rows matching the filters, ignoring limit and offset"
              },
              "limit": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "offset": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "items",
              "total",
              "limit",
              "offset"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "run",
          "rows"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.list_runs",
      "toolName": "import_list_runs",
      "group": "import",
      "title": "List import runs",
      "description": "Past imports and dry runs, newest first, with their counts and who ran them.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "entity": {
            "type": "string",
            "enum": [
              "accounts",
              "contacts",
              "sites",
              "products",
              "parts",
              "machines"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "dry_run",
              "applying",
              "applied",
              "failed"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "entity": {
                  "type": "string",
                  "enum": [
                    "accounts",
                    "contacts",
                    "sites",
                    "products",
                    "parts",
                    "machines"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "google_sheet",
                    "google_drive",
                    "csv",
                    "hubspot_export",
                    "pdf_extract"
                  ]
                },
                "sourceName": {
                  "description": "File or sheet name",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "dry_run",
                    "applying",
                    "applied",
                    "failed"
                  ]
                },
                "mapping": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Source column name to target field name"
                },
                "totalRows": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "createCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "updateCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "duplicateCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "errorCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "createdByName": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "appliedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "entity",
                "source",
                "sourceName",
                "status",
                "mapping",
                "totalRows",
                "createCount",
                "updateCount",
                "duplicateCount",
                "errorCount",
                "createdByName",
                "createdAt",
                "appliedAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.discard_run",
      "toolName": "import_discard_run",
      "group": "import",
      "title": "Discard a dry run",
      "description": "Delete a dry run that will not be applied, with its stored preview rows. Applied runs cannot be discarded.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "runId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "import.read_google_sheet",
      "toolName": "import_read_google_sheet",
      "group": "import",
      "title": "Read a Google Sheet for import",
      "description": "Read one tab of a Google Sheet with the caller's own Google access (they connect Google Sheets once, read only) and return its rows keyed by the header row, ready for import.dry_run. Give the sheet's link or id; the tab in the link (gid) is used, else the named tab, else the first. connected is false, with no rows, until the caller has connected Google Sheets. Writes nothing.",
      "kind": "read",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "sheet": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500,
            "description": "Google Sheets link (https://docs.google.com/spreadsheets/d/...) or spreadsheet id"
          },
          "tab": {
            "description": "Tab name; defaults to the tab in the link, else the first tab",
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "sheet"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "title": {
            "description": "Spreadsheet title",
            "type": [
              "string",
              "null"
            ]
          },
          "tab": {
            "type": [
              "string",
              "null"
            ]
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "maxItems": 5000,
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the tab has more than 5,000 data rows; only the first 5,000 are returned"
          }
        },
        "required": [
          "connected",
          "title",
          "tab",
          "columns",
          "rows",
          "truncated"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "reports.dashboard",
      "toolName": "reports_dashboard",
      "group": "reports",
      "title": "Get the home dashboard",
      "description": "The home dashboard in one call: open orders by stage, orders not yet valid (with what each is missing), open and down tickets, warranties ending within 60 days, overdue tasks, accounts not contacted in 90 days, and low-stock parts. Counts come with the top rows of each list.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "listLimit": {
            "default": 8,
            "description": "Rows to include in each list",
            "type": "integer",
            "minimum": 0,
            "maximum": 50
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "generatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "today": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "ordersByStage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                }
              },
              "required": [
                "stage",
                "label",
                "count",
                "totalCents"
              ],
              "additionalProperties": false
            }
          },
          "openOrderCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "openOrderValueCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "invalidOrders": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "orderNumber": {
                      "type": "string"
                    },
                    "accountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "siteId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Delivery site"
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stage": {
                      "type": "string",
                      "enum": [
                        "received",
                        "in_build",
                        "ready_to_ship",
                        "shipped",
                        "delivered",
                        "set_up",
                        "commissioned",
                        "trained",
                        "closed"
                      ]
                    },
                    "stageDates": {
                      "type": "object",
                      "properties": {
                        "received": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "in_build": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "ready_to_ship": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "shipped": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "delivered": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "set_up": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "commissioned": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "trained": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "closed": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                              "description": "Date as YYYY-MM-DD"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "received",
                        "in_build",
                        "ready_to_ship",
                        "shipped",
                        "delivered",
                        "set_up",
                        "commissioned",
                        "trained",
                        "closed"
                      ],
                      "additionalProperties": false,
                      "description": "Date each stage was reached; null if not yet"
                    },
                    "signedQuoteDocumentId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "signedQuoteReceivedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "totalCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    "balanceRemainingCents": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "Amount in integer US cents (zero or more)"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Null until someone records it; 0 means paid in full"
                    },
                    "isValid": {
                      "type": "boolean"
                    },
                    "financingPartner": {
                      "type": "string",
                      "enum": [
                        "none",
                        "commercial_capital",
                        "northland_capital",
                        "other"
                      ]
                    },
                    "financingStatus": {
                      "type": "string",
                      "enum": [
                        "not_applicable",
                        "pending",
                        "approved",
                        "declined",
                        "funded"
                      ]
                    },
                    "financingNotes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "poNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expectedShipOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ownerUserId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "accountName": {
                      "type": "string"
                    },
                    "siteName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "signed_quote",
                          "signed_quote_received_on",
                          "balance_remaining"
                        ]
                      }
                    },
                    "nextStage": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "received",
                            "in_build",
                            "ready_to_ship",
                            "shipped",
                            "delivered",
                            "set_up",
                            "commissioned",
                            "trained",
                            "closed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lineCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "machineCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "orderNumber",
                    "accountId",
                    "siteId",
                    "title",
                    "stage",
                    "stageDates",
                    "signedQuoteDocumentId",
                    "signedQuoteReceivedOn",
                    "totalCents",
                    "balanceRemainingCents",
                    "isValid",
                    "financingPartner",
                    "financingStatus",
                    "financingNotes",
                    "poNumber",
                    "expectedShipOn",
                    "ownerUserId",
                    "notes",
                    "createdAt",
                    "updatedAt",
                    "accountName",
                    "siteName",
                    "missing",
                    "nextStage",
                    "lineCount",
                    "machineCount"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "count",
              "items"
            ],
            "additionalProperties": false
          },
          "tickets": {
            "type": "object",
            "properties": {
              "openCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "downCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "down": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "ticketNumber": {
                      "type": "string"
                    },
                    "accountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "machineId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "contactId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "category": {
                      "type": "string",
                      "enum": [
                        "mechanical",
                        "electrical",
                        "controls",
                        "hydraulic",
                        "pneumatic",
                        "structural",
                        "calibration",
                        "operator_training",
                        "other"
                      ]
                    },
                    "priority": {
                      "type": "string",
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "down"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "new",
                        "diagnosing",
                        "parts_on_order",
                        "scheduled",
                        "waiting_on_customer",
                        "resolved",
                        "follow_up_complete"
                      ]
                    },
                    "rootCause": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "component_failure",
                            "manufacturing_defect",
                            "wear",
                            "operator_error",
                            "installation",
                            "shipping_damage",
                            "environment",
                            "design",
                            "unknown"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolution": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "staff",
                        "portal",
                        "email",
                        "agent"
                      ]
                    },
                    "assignedToUserId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isWarranty": {
                      "type": "boolean",
                      "description": "Whether the work is covered by warranty"
                    },
                    "onsiteHours": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total on-site hours logged"
                    },
                    "travelHours": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total travel hours logged"
                    },
                    "travelMiles": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total travel miles logged"
                    },
                    "openedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "scheduledFor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "accountName": {
                      "type": "string"
                    },
                    "machineSerialNumber": {
                      "type": "string"
                    },
                    "machineModel": {
                      "type": "string"
                    },
                    "assignedToName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "ticketNumber",
                    "accountId",
                    "machineId",
                    "contactId",
                    "title",
                    "description",
                    "category",
                    "priority",
                    "status",
                    "rootCause",
                    "resolution",
                    "source",
                    "assignedToUserId",
                    "isWarranty",
                    "onsiteHours",
                    "travelHours",
                    "travelMiles",
                    "openedAt",
                    "scheduledFor",
                    "resolvedAt",
                    "createdAt",
                    "updatedAt",
                    "accountName",
                    "machineSerialNumber",
                    "machineModel",
                    "assignedToName"
                  ],
                  "additionalProperties": false
                }
              },
              "recent": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "ticketNumber": {
                      "type": "string"
                    },
                    "accountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "machineId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "contactId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "category": {
                      "type": "string",
                      "enum": [
                        "mechanical",
                        "electrical",
                        "controls",
                        "hydraulic",
                        "pneumatic",
                        "structural",
                        "calibration",
                        "operator_training",
                        "other"
                      ]
                    },
                    "priority": {
                      "type": "string",
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "down"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "new",
                        "diagnosing",
                        "parts_on_order",
                        "scheduled",
                        "waiting_on_customer",
                        "resolved",
                        "follow_up_complete"
                      ]
                    },
                    "rootCause": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "component_failure",
                            "manufacturing_defect",
                            "wear",
                            "operator_error",
                            "installation",
                            "shipping_damage",
                            "environment",
                            "design",
                            "unknown"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolution": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "staff",
                        "portal",
                        "email",
                        "agent"
                      ]
                    },
                    "assignedToUserId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isWarranty": {
                      "type": "boolean",
                      "description": "Whether the work is covered by warranty"
                    },
                    "onsiteHours": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total on-site hours logged"
                    },
                    "travelHours": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total travel hours logged"
                    },
                    "travelMiles": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total travel miles logged"
                    },
                    "openedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "scheduledFor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resolvedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "accountName": {
                      "type": "string"
                    },
                    "machineSerialNumber": {
                      "type": "string"
                    },
                    "machineModel": {
                      "type": "string"
                    },
                    "assignedToName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "ticketNumber",
                    "accountId",
                    "machineId",
                    "contactId",
                    "title",
                    "description",
                    "category",
                    "priority",
                    "status",
                    "rootCause",
                    "resolution",
                    "source",
                    "assignedToUserId",
                    "isWarranty",
                    "onsiteHours",
                    "travelHours",
                    "travelMiles",
                    "openedAt",
                    "scheduledFor",
                    "resolvedAt",
                    "createdAt",
                    "updatedAt",
                    "accountName",
                    "machineSerialNumber",
                    "machineModel",
                    "assignedToName"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "openCount",
              "downCount",
              "down",
              "recent"
            ],
            "additionalProperties": false
          },
          "expiringWarranties": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "withinDays": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "serialNumber": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "plant",
                        "mixer",
                        "silo",
                        "feeder",
                        "power_pack"
                      ]
                    },
                    "model": {
                      "type": "string"
                    },
                    "configuration": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "accountId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Current owner"
                    },
                    "siteId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Current site"
                    },
                    "orderId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Order the machine was built for"
                    },
                    "productId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "in_build",
                        "in_transit",
                        "operating",
                        "down",
                        "idle",
                        "retired"
                      ]
                    },
                    "builtOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "shippedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "commissionedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "warrantyStart": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "warrantyEnd": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                          "description": "Date as YYYY-MM-DD"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "warrantyState": {
                      "type": "string",
                      "enum": [
                        "none",
                        "active",
                        "expiring",
                        "expired"
                      ],
                      "description": "Computed from the warranty dates and today's date"
                    },
                    "warrantyDaysLeft": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Days until the warranty ends; negative once expired; null if not started"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "accountName": {
                      "type": "string"
                    },
                    "siteName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "siteCity": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "siteState": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "latitude": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "longitude": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "openTicketCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "serialNumber",
                    "type",
                    "model",
                    "configuration",
                    "options",
                    "accountId",
                    "siteId",
                    "orderId",
                    "productId",
                    "status",
                    "builtOn",
                    "shippedOn",
                    "commissionedOn",
                    "warrantyStart",
                    "warrantyEnd",
                    "warrantyState",
                    "warrantyDaysLeft",
                    "notes",
                    "createdAt",
                    "updatedAt",
                    "accountName",
                    "siteName",
                    "siteCity",
                    "siteState",
                    "latitude",
                    "longitude",
                    "openTicketCount"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "count",
              "withinDays",
              "items"
            ],
            "additionalProperties": false
          },
          "overdueTasks": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "task",
                        "call",
                        "visit",
                        "delivery",
                        "commissioning",
                        "service",
                        "check_in"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "done",
                        "cancelled"
                      ]
                    },
                    "dueOn": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Day the task is due or the appointment happens"
                    },
                    "startsAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Start time for timed appointments; null for all-day items"
                    },
                    "endsAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "location": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assignedToUserId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "assignedToName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "accountId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "accountName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "orderId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "machineId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ticketId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "siteId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "checkInId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "isOverdue": {
                      "type": "boolean",
                      "description": "Open and due before today"
                    },
                    "googleEventId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "syncState": {
                      "type": "string",
                      "enum": [
                        "not_synced",
                        "pending",
                        "synced",
                        "error"
                      ]
                    },
                    "syncedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "syncError": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "completedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "title",
                    "notes",
                    "status",
                    "dueOn",
                    "startsAt",
                    "endsAt",
                    "location",
                    "assignedToUserId",
                    "assignedToName",
                    "accountId",
                    "accountName",
                    "contactId",
                    "orderId",
                    "machineId",
                    "ticketId",
                    "siteId",
                    "checkInId",
                    "isOverdue",
                    "googleEventId",
                    "syncState",
                    "syncedAt",
                    "syncError",
                    "completedAt",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "count",
              "items"
            ],
            "additionalProperties": false
          },
          "accountsNotContacted": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "days": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    "name": {
                      "type": "string"
                    },
                    "normalizedName": {
                      "type": "string",
                      "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
                    },
                    "segment": {
                      "type": "string",
                      "enum": [
                        "concrete_producer",
                        "multiservice"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "prospect",
                        "inactive"
                      ]
                    },
                    "phone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "website": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqLine1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqLine2": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqCity": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqState": {
                      "description": "Two-letter US state or region code",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqPostalCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hqCountry": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "hubspotCompanyId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ownerUserId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "description": "Record id (UUID)"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Staff user who owns the account"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lastContactedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                          "description": "UTC timestamp, ISO 8601 with Z"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Most recent call, email, text or visit"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    "machineCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "openOrderCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "openTicketCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "primaryContactName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "daysSinceContact": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "normalizedName",
                    "segment",
                    "status",
                    "phone",
                    "website",
                    "hqLine1",
                    "hqLine2",
                    "hqCity",
                    "hqState",
                    "hqPostalCode",
                    "hqCountry",
                    "hubspotCompanyId",
                    "ownerUserId",
                    "notes",
                    "lastContactedAt",
                    "createdAt",
                    "updatedAt",
                    "machineCount",
                    "openOrderCount",
                    "openTicketCount",
                    "primaryContactName",
                    "daysSinceContact"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "count",
              "days",
              "items"
            ],
            "additionalProperties": false
          },
          "lowStock": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "count"
            ],
            "additionalProperties": false
          },
          "machines": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "operating": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "down": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "underWarranty": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "total",
              "operating",
              "down",
              "underWarranty"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "generatedAt",
          "today",
          "ordersByStage",
          "openOrderCount",
          "openOrderValueCents",
          "invalidOrders",
          "tickets",
          "expiringWarranties",
          "overdueTasks",
          "accountsNotContacted",
          "lowStock",
          "machines"
        ],
        "additionalProperties": false
      },
      "view": "dashboard"
    },
    {
      "name": "reports.installed_base",
      "toolName": "reports_installed_base",
      "group": "reports",
      "title": "Report: installed base by state and model",
      "description": "Counts of machines by the state of their current site and by model, plus totals by type and status. Retired machines are left out unless asked for.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "includeRetired": {
            "default": false,
            "type": "boolean"
          },
          "type": {
            "type": "string",
            "enum": [
              "plant",
              "mixer",
              "silo",
              "feeder",
              "power_pack"
            ]
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byState": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string",
                  "description": "State code, or Unknown when the machine has no site"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "state",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byModel": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "model",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byStateAndModel": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "state",
                "model",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byType": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "type",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "byStatus": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "status",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "total",
          "byState",
          "byModel",
          "byStateAndModel",
          "byType",
          "byStatus"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "reports.tickets_by_root_cause",
      "toolName": "reports_tickets_by_root_cause",
      "group": "reports",
      "title": "Report: tickets by root cause",
      "description": "Service tickets opened in a date range (default the last 365 days) grouped by root cause and by category, with on-site hours, travel hours and parts cost for each.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "model": {
            "type": "string",
            "maxLength": 100
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byRootCause": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rootCause": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "component_failure",
                        "manufacturing_defect",
                        "wear",
                        "operator_error",
                        "installation",
                        "shipping_damage",
                        "environment",
                        "design",
                        "unknown"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null for tickets with no root cause recorded yet"
                },
                "label": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "onsiteHours": {
                  "type": "number"
                },
                "travelHours": {
                  "type": "number"
                },
                "partsCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "warrantyCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "rootCause",
                "label",
                "count",
                "onsiteHours",
                "travelHours",
                "partsCents",
                "warrantyCount"
              ],
              "additionalProperties": false
            }
          },
          "byCategory": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "enum": [
                    "mechanical",
                    "electrical",
                    "controls",
                    "hydraulic",
                    "pneumatic",
                    "structural",
                    "calibration",
                    "operator_training",
                    "other"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "category",
                "label",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "from",
          "to",
          "total",
          "byRootCause",
          "byCategory"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "reports.parts_revenue",
      "toolName": "reports_parts_revenue",
      "group": "reports",
      "title": "Report: parts revenue",
      "description": "Revenue from parts orders (ordered, shipped or delivered) in a date range, by month, by account and by part. Default range is the last 12 months.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "top": {
            "default": 10,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "to": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "orderCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byMonth": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "type": "string",
                  "description": "YYYY-MM"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "orderCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "month",
                "totalCents",
                "orderCount"
              ],
              "additionalProperties": false
            }
          },
          "byAccount": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "orderCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "accountId",
                "accountName",
                "totalCents",
                "orderCount"
              ],
              "additionalProperties": false
            }
          },
          "byPart": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "partId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "partNumber": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                }
              },
              "required": [
                "partId",
                "partNumber",
                "description",
                "quantity",
                "totalCents"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "from",
          "to",
          "totalCents",
          "orderCount",
          "byMonth",
          "byAccount",
          "byPart"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "reports.expiring_warranties",
      "toolName": "reports_expiring_warranties",
      "group": "reports",
      "title": "Report: expiring warranties",
      "description": "Machines whose warranty ends within a number of days (default 60), soonest first, with owner and site. Set includeExpiredDays to also see warranties that ended recently.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "withinDays": {
            "default": 60,
            "type": "integer",
            "minimum": 1,
            "maximum": 730
          },
          "includeExpiredDays": {
            "default": 0,
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "withinDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "today": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Current owner"
                },
                "siteId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Current site"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Order the machine was built for"
                },
                "productId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "builtOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shippedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ],
                  "description": "Computed from the warranty dates and today's date"
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Days until the warranty ends; negative once expired; null if not started"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "accountName": {
                  "type": "string"
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "latitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "longitude": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "accountId",
                "siteId",
                "orderId",
                "productId",
                "status",
                "builtOn",
                "shippedOn",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "notes",
                "createdAt",
                "updatedAt",
                "accountName",
                "siteName",
                "siteCity",
                "siteState",
                "latitude",
                "longitude",
                "openTicketCount"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "withinDays",
          "today",
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "reports.accounts_not_contacted",
      "toolName": "reports_accounts_not_contacted",
      "group": "reports",
      "title": "Report: accounts not contacted",
      "description": "Active accounts with no call, email, text or visit in a number of days (default 90), longest silence first. Accounts never contacted come first.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "days": {
            "default": 90,
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          },
          "limit": {
            "default": 100,
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "days": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "today": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "name": {
                  "type": "string"
                },
                "normalizedName": {
                  "type": "string",
                  "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
                },
                "segment": {
                  "type": "string",
                  "enum": [
                    "concrete_producer",
                    "multiservice"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "prospect",
                    "inactive"
                  ]
                },
                "phone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "website": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqLine1": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqLine2": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqState": {
                  "description": "Two-letter US state or region code",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqPostalCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hqCountry": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "hubspotCompanyId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "ownerUserId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Staff user who owns the account"
                },
                "notes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lastContactedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Most recent call, email, text or visit"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "machineCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "openOrderCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "openTicketCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "primaryContactName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "daysSinceContact": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "normalizedName",
                "segment",
                "status",
                "phone",
                "website",
                "hqLine1",
                "hqLine2",
                "hqCity",
                "hqState",
                "hqPostalCode",
                "hqCountry",
                "hubspotCompanyId",
                "ownerUserId",
                "notes",
                "lastContactedAt",
                "createdAt",
                "updatedAt",
                "machineCount",
                "openOrderCount",
                "openTicketCount",
                "primaryContactName",
                "daysSinceContact"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "days",
          "today",
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "search.query",
      "toolName": "search_query",
      "group": "search",
      "title": "Search everything",
      "description": "One search across accounts, contacts, sites, machines (by serial number), orders, tickets, parts, parts orders and documents. Matches prefixes, so 'M300-24' finds serial M300-2417. Returns the best matches with the record type, a title, a snippet and the path of the record in the web app.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "types": {
            "description": "Limit to these record types",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "account",
                "contact",
                "site",
                "machine",
                "order",
                "ticket",
                "part",
                "parts_order",
                "document"
              ]
            }
          },
          "limit": {
            "default": 20,
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          }
        },
        "required": [
          "query"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entityType": {
                  "type": "string",
                  "enum": [
                    "account",
                    "contact",
                    "site",
                    "machine",
                    "order",
                    "ticket",
                    "part",
                    "parts_order",
                    "document"
                  ]
                },
                "entityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "title": {
                  "type": "string"
                },
                "subtitle": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "snippet": {
                  "description": "Matching text with the hit wrapped in <mark> tags",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "path": {
                  "type": "string",
                  "description": "Path of the record in the web app, for example /orders/{id}"
                }
              },
              "required": [
                "entityType",
                "entityId",
                "title",
                "subtitle",
                "snippet",
                "accountId",
                "path"
              ],
              "additionalProperties": false
            }
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "Number of results per record type"
          }
        },
        "required": [
          "query",
          "results",
          "counts"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "search.reindex",
      "toolName": "search_reindex",
      "group": "search",
      "title": "Rebuild the search index",
      "description": "Rebuild the full-text search index from the tables. Run after a bulk import or if search results look out of date.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "types": {
            "description": "Only these record types; all when omitted",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "account",
                "contact",
                "site",
                "machine",
                "order",
                "ticket",
                "part",
                "parts_order",
                "document"
              ]
            }
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "indexed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "byType": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          }
        },
        "required": [
          "indexed",
          "byType"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "audit.list",
      "toolName": "audit_list",
      "group": "audit",
      "title": "Read the audit log",
      "description": "Who changed what and when. Every write made through the app, the MCP server, an agent or the portal is recorded with the actor, the operation and the record. Filter by record, account, actor, operation or time range.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "entityType": {
            "type": "string",
            "enum": [
              "account",
              "contact",
              "site",
              "order",
              "product",
              "machine",
              "ticket",
              "warranty_claim",
              "part",
              "parts_order",
              "document",
              "activity",
              "task",
              "check_in",
              "opportunity",
              "service_plan",
              "service_contract",
              "training_record",
              "import_run",
              "user",
              "portal_invite",
              "customer_user",
              "calendar_feed",
              "stock_movement",
              "email"
            ]
          },
          "entityId": {
            "type": "string",
            "maxLength": 64
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "actorUserId": {
            "type": "string",
            "maxLength": 64
          },
          "actorEmail": {
            "type": "string",
            "maxLength": 254
          },
          "operation": {
            "description": "Exact operation name, or a group prefix such as orders.",
            "type": "string",
            "maxLength": 100
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "actorKind": {
                  "type": "string",
                  "enum": [
                    "staff",
                    "customer",
                    "agent",
                    "system"
                  ]
                },
                "actorUserId": {
                  "type": "string"
                },
                "actorEmail": {
                  "type": "string"
                },
                "actorName": {
                  "type": "string"
                },
                "operation": {
                  "type": "string"
                },
                "entityType": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "product",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "part",
                        "parts_order",
                        "document",
                        "activity",
                        "task",
                        "check_in",
                        "opportunity",
                        "service_plan",
                        "service_contract",
                        "training_record",
                        "import_run",
                        "user",
                        "portal_invite",
                        "customer_user",
                        "calendar_feed",
                        "stock_movement",
                        "email"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entityId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "summary": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "detail": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "at",
                "actorKind",
                "actorUserId",
                "actorEmail",
                "actorName",
                "operation",
                "entityType",
                "entityId",
                "accountId",
                "summary",
                "detail",
                "requestId"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.me",
      "toolName": "users_me",
      "group": "users",
      "title": "Who am I",
      "description": "The caller's own identity: name, email, role and, for portal users, their account. Also lists the operations the caller may use.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer",
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "staff",
              "customer",
              "agent",
              "system"
            ]
          },
          "userId": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "editor",
              "viewer",
              "customer"
            ]
          },
          "accountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountName": {
            "type": [
              "string",
              "null"
            ]
          },
          "allowedOperations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "kind",
          "userId",
          "email",
          "name",
          "role",
          "accountId",
          "accountName",
          "allowedOperations"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.list",
      "toolName": "users_list",
      "group": "users",
      "title": "List staff users",
      "description": "Cemco staff with access to the CRM, their roles (admin, editor, viewer) and when they were last seen.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "includeInactive": {
            "default": false,
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "email": {
                  "type": "string",
                  "maxLength": 254,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "admin",
                    "editor",
                    "viewer"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "lastSeenAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "email",
                "name",
                "role",
                "active",
                "lastSeenAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.invite",
      "toolName": "users_invite",
      "group": "users",
      "title": "Add a staff user",
      "description": "Give a Cemco colleague access before their first sign-in by adding their work email with a role. The email must be on the staff domain. They sign in with Google or an email code; no password is set here.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "role": {
            "default": "viewer",
            "type": "string",
            "enum": [
              "admin",
              "editor",
              "viewer"
            ]
          }
        },
        "required": [
          "email",
          "name"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "editor",
                  "viewer"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "email",
              "name",
              "role",
              "active",
              "lastSeenAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "user",
          "created"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.set_role",
      "toolName": "users_set_role",
      "group": "users",
      "title": "Change a staff user's role",
      "description": "Set a staff user's role to admin, editor or viewer. The last active admin cannot be demoted.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "editor",
              "viewer"
            ]
          }
        },
        "required": [
          "id",
          "role"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "editor",
                  "viewer"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "email",
              "name",
              "role",
              "active",
              "lastSeenAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "user"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.set_active",
      "toolName": "users_set_active",
      "group": "users",
      "title": "Deactivate or reactivate a staff user",
      "description": "Turn a staff user's access off (signing them out everywhere) or back on. The last active admin cannot be deactivated. History and audit entries are kept.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "active"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "editor",
                  "viewer"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "email",
              "name",
              "role",
              "active",
              "lastSeenAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "user"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.update_profile",
      "toolName": "users_update_profile",
      "group": "users",
      "title": "Update my profile",
      "description": "Change the display name shown for the caller on records, the audit log and emails.",
      "kind": "write",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "name"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "editor",
                  "viewer"
                ]
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "email",
              "name",
              "role",
              "active",
              "lastSeenAt",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "user"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.list_api_keys",
      "toolName": "users_list_api_keys",
      "group": "users",
      "title": "List API keys",
      "description": "API keys issued to agents and scripts, with the role each acts as. Secrets are never shown again after creation.",
      "kind": "read",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "prefix": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "admin",
                    "editor",
                    "viewer"
                  ]
                },
                "ownerEmail": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "lastUsedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expiresAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revoked": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "name",
                "prefix",
                "role",
                "ownerEmail",
                "createdAt",
                "lastUsedAt",
                "expiresAt",
                "revoked"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.create_api_key",
      "toolName": "users_create_api_key",
      "group": "users",
      "title": "Create an API key",
      "description": "Issue an API key for an agent or script that will act with the given staff role. The secret is returned once; store it safely.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "What the key is for, for example Email filing agent"
          },
          "role": {
            "default": "editor",
            "type": "string",
            "enum": [
              "admin",
              "editor",
              "viewer"
            ]
          },
          "expiresInDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          }
        },
        "required": [
          "name"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The secret; shown only now"
          },
          "info": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "admin",
                  "editor",
                  "viewer"
                ]
              },
              "ownerEmail": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "lastUsedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expiresAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revoked": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "name",
              "prefix",
              "role",
              "ownerEmail",
              "createdAt",
              "lastUsedAt",
              "expiresAt",
              "revoked"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "key",
          "info"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "users.revoke_api_key",
      "toolName": "users_revoke_api_key",
      "group": "users",
      "title": "Revoke an API key",
      "description": "Stop an API key working immediately. Anything still using the key gets an unauthorized error.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.create",
      "toolName": "portal_invites_create",
      "group": "portal_invites",
      "title": "Invite a customer to the portal",
      "description": "Invite a person at a customer to the portal. Emails them a link (valid 14 days) to set a password; once accepted their login is tied to this one account and they see only its orders, machines and documents. Give contactId to invite an existing contact, or an email and name. Inviting an email that already has a pending invite re-sends it.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sendEmail": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "accountId"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "invite": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "revoked",
                  "expired"
                ]
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "invitedByName": {
                "type": "string"
              },
              "acceptedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "contactId",
              "email",
              "name",
              "status",
              "expiresAt",
              "invitedByName",
              "acceptedAt",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "inviteUrl": {
            "type": "string",
            "description": "Link the customer opens to accept; also emailed when sendEmail is true"
          },
          "emailQueued": {
            "type": "boolean"
          },
          "resent": {
            "type": "boolean"
          }
        },
        "required": [
          "invite",
          "inviteUrl",
          "emailQueued",
          "resent"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.list",
      "toolName": "portal_invites_list",
      "group": "portal_invites",
      "title": "List portal invites",
      "description": "Portal invitations for one account or all accounts, with status pending, accepted, revoked or expired.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "accepted",
              "revoked",
              "expired"
            ]
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "type": "string",
                  "maxLength": 254,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "accepted",
                    "revoked",
                    "expired"
                  ]
                },
                "expiresAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "invitedByName": {
                  "type": "string"
                },
                "acceptedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "accountName",
                "contactId",
                "email",
                "name",
                "status",
                "expiresAt",
                "invitedByName",
                "acceptedAt",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.revoke",
      "toolName": "portal_invites_revoke",
      "group": "portal_invites",
      "title": "Revoke a portal invite",
      "description": "Cancel a pending portal invitation so its link stops working.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "invite": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "revoked",
                  "expired"
                ]
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "invitedByName": {
                "type": "string"
              },
              "acceptedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "contactId",
              "email",
              "name",
              "status",
              "expiresAt",
              "invitedByName",
              "acceptedAt",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "invite"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.list_users",
      "toolName": "portal_invites_list_users",
      "group": "portal_invites",
      "title": "List portal users",
      "description": "Customer logins for one account or all accounts, with when each was last seen.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "includeInactive": {
            "default": false,
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "accountName": {
                  "type": "string"
                },
                "contactId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "type": "string",
                  "maxLength": 254,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "name": {
                  "type": "string"
                },
                "active": {
                  "type": "boolean"
                },
                "lastSeenAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "accountId",
                "accountName",
                "contactId",
                "email",
                "name",
                "active",
                "lastSeenAt",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.set_user_active",
      "toolName": "portal_invites_set_user_active",
      "group": "portal_invites",
      "title": "Turn a portal user's access off or on",
      "description": "Deactivate a customer's portal login (signing them out) or reactivate it.",
      "kind": "write",
      "roles": [
        "admin",
        "editor"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "customerUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "customerUserId",
          "active"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "contactId",
              "email",
              "name",
              "active",
              "lastSeenAt",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "user"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.lookup",
      "toolName": "portal_invites_lookup",
      "group": "portal_invites",
      "title": "Look up an invite token",
      "description": "Internal: validates an invite token for the accept-invite page and returns who it is for.",
      "kind": "read",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "token"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "ok",
              "not_found",
              "expired",
              "revoked",
              "accepted"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "accountName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "valid",
          "reason",
          "email",
          "name",
          "accountName"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal_invites.accept",
      "toolName": "portal_invites_accept",
      "group": "portal_invites",
      "title": "Accept a portal invite",
      "description": "Internal: accepts an invite token. Creates the portal login in the auth service (with the chosen password), links it to the invite's account in customer_users and marks the invite accepted.",
      "kind": "write",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "password": {
            "description": "Omit for magic-link-only sign-in",
            "type": "string",
            "minLength": 10,
            "maxLength": 200
          }
        },
        "required": [
          "token"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountName": {
                "type": "string"
              },
              "contactId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "type": "string",
                "maxLength": 254,
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "active": {
                "type": "boolean"
              },
              "lastSeenAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "accountId",
              "accountName",
              "contactId",
              "email",
              "name",
              "active",
              "lastSeenAt",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "email": {
            "type": "string"
          }
        },
        "required": [
          "user",
          "email"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.me",
      "toolName": "portal_me",
      "group": "portal",
      "title": "Portal: my account",
      "description": "The signed-in customer's own account: company name and address, their contact details, and Cemco's service contact.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "email"
            ],
            "additionalProperties": false
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqState": {
                "description": "Two-letter US state or region code",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqPostalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hqCountry": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "phone",
              "hqLine1",
              "hqLine2",
              "hqCity",
              "hqState",
              "hqPostalCode",
              "hqCountry"
            ],
            "additionalProperties": false
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  },
                  "role": {
                    "description": "Job title or role at the customer, for example Plant manager",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "mobile": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "preferredChannel": {
                    "type": "string",
                    "enum": [
                      "email",
                      "phone",
                      "text"
                    ]
                  }
                },
                "required": [
                  "id",
                  "firstName",
                  "lastName",
                  "role",
                  "email",
                  "mobile",
                  "phone",
                  "preferredChannel"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "cemcoContact": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "email",
              "phone"
            ],
            "additionalProperties": false
          },
          "counts": {
            "type": "object",
            "properties": {
              "openOrders": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "machines": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "openTickets": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "ordersNeedingSignature": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "openOrders",
              "machines",
              "openTickets",
              "ordersNeedingSignature"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "user",
          "account",
          "contact",
          "cemcoContact",
          "counts"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.orders",
      "toolName": "portal_orders",
      "group": "portal",
      "title": "Portal: my orders",
      "description": "The customer's own orders, newest first, with the current stage and whether a quote is waiting for signature.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "open": {
            "type": "boolean"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "orderNumber": {
                  "type": "string"
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "stageLabel": {
                  "type": "string"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "balanceRemainingCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Amount in integer US cents (zero or more)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "financingPartner": {
                  "type": "string",
                  "enum": [
                    "none",
                    "commercial_capital",
                    "northland_capital",
                    "other"
                  ]
                },
                "financingStatus": {
                  "type": "string",
                  "enum": [
                    "not_applicable",
                    "pending",
                    "approved",
                    "declined",
                    "funded"
                  ]
                },
                "poNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expectedShipOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quoteSigned": {
                  "type": "boolean"
                },
                "quoteSignedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "needsSignature": {
                  "type": "boolean",
                  "description": "True when a quote is waiting for the customer's signature"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                }
              },
              "required": [
                "id",
                "orderNumber",
                "title",
                "stage",
                "stageLabel",
                "totalCents",
                "balanceRemainingCents",
                "financingPartner",
                "financingStatus",
                "poNumber",
                "expectedShipOn",
                "siteName",
                "quoteSigned",
                "quoteSignedOn",
                "needsSignature",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.order",
      "toolName": "portal_order",
      "group": "portal",
      "title": "Portal: one order",
      "description": "One of the customer's own orders with line items, the status timeline, documents and the machines built for it. Not found if the order belongs to another account.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageLabel": {
            "type": "string"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ]
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "siteName": {
            "type": [
              "string",
              "null"
            ]
          },
          "quoteSigned": {
            "type": "boolean"
          },
          "quoteSignedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "needsSignature": {
            "type": "boolean",
            "description": "True when a quote is waiting for the customer's signature"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "sku": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "unitPriceCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                "totalCents": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                }
              },
              "required": [
                "id",
                "sku",
                "description",
                "quantity",
                "unitPriceCents",
                "totalCents"
              ],
              "additionalProperties": false
            }
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "done",
                    "current",
                    "upcoming"
                  ]
                },
                "date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "stage",
                "label",
                "state",
                "date"
              ],
              "additionalProperties": false
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "createdAt",
                "orderId",
                "orderNumber"
              ],
              "additionalProperties": false
            }
          },
          "machines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ]
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "status",
                "siteName",
                "siteCity",
                "siteState",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "orderId"
              ],
              "additionalProperties": false
            }
          },
          "quoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "The quote to review and sign, if one is waiting"
          }
        },
        "required": [
          "id",
          "orderNumber",
          "title",
          "stage",
          "stageLabel",
          "totalCents",
          "balanceRemainingCents",
          "financingPartner",
          "financingStatus",
          "poNumber",
          "expectedShipOn",
          "siteName",
          "quoteSigned",
          "quoteSignedOn",
          "needsSignature",
          "createdAt",
          "lines",
          "timeline",
          "documents",
          "machines",
          "quoteDocumentId"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.order_timeline",
      "toolName": "portal_order_timeline",
      "group": "portal",
      "title": "Portal: order status timeline",
      "description": "The nine lifecycle stages of one of the customer's own orders, each marked done, current or upcoming, with the date reached.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stage": {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "done",
                    "current",
                    "upcoming"
                  ]
                },
                "date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "stage",
                "label",
                "state",
                "date"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "orderId",
          "orderNumber",
          "stage",
          "timeline"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.sign_quote",
      "toolName": "portal_sign_quote",
      "group": "portal",
      "title": "Portal: sign the quote",
      "description": "The customer signs the quote (the contract) for one of their own orders. Stores a signed record containing the quote reference, the signer's typed name and title, the drawn signature, the time and the signer's login, as the order's signed quote document, and sets the signed-quote received date to today. Fails with a conflict if the order already has a signed quote.",
      "kind": "write",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "signerName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 200
          },
          "signerTitle": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "signatureDataUrl": {
            "description": "Drawn signature as a PNG or SVG data URL",
            "type": "string",
            "maxLength": 500000,
            "pattern": "^data:image\\/(png|svg\\+xml);base64,"
          },
          "agree": {
            "type": "boolean",
            "const": true,
            "description": "The customer ticked the box agreeing to the quote's terms"
          }
        },
        "required": [
          "orderId",
          "signerName",
          "agree"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "order": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "orderNumber": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "stage": {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              "stageLabel": {
                "type": "string"
              },
              "totalCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              "balanceRemainingCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "financingPartner": {
                "type": "string",
                "enum": [
                  "none",
                  "commercial_capital",
                  "northland_capital",
                  "other"
                ]
              },
              "financingStatus": {
                "type": "string",
                "enum": [
                  "not_applicable",
                  "pending",
                  "approved",
                  "declined",
                  "funded"
                ]
              },
              "poNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expectedShipOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siteName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "quoteSigned": {
                "type": "boolean"
              },
              "quoteSignedOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "needsSignature": {
                "type": "boolean",
                "description": "True when a quote is waiting for the customer's signature"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              }
            },
            "required": [
              "id",
              "orderNumber",
              "title",
              "stage",
              "stageLabel",
              "totalCents",
              "balanceRemainingCents",
              "financingPartner",
              "financingStatus",
              "poNumber",
              "expectedShipOn",
              "siteName",
              "quoteSigned",
              "quoteSignedOn",
              "needsSignature",
              "createdAt"
            ],
            "additionalProperties": false
          },
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "quote",
                  "purchase_order",
                  "drawing",
                  "manual",
                  "inspection_report",
                  "photo",
                  "training_record",
                  "invoice",
                  "email_attachment",
                  "export",
                  "other"
                ]
              },
              "title": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "orderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "orderNumber": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "filename",
              "contentType",
              "sizeBytes",
              "createdAt",
              "orderId",
              "orderNumber"
            ],
            "additionalProperties": false
          },
          "signedOn": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "orderIsValid": {
            "type": "boolean",
            "description": "Whether the order now has everything it needs to go into build"
          }
        },
        "required": [
          "order",
          "document",
          "signedOn",
          "orderIsValid"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.export_order",
      "toolName": "portal_export_order",
      "group": "portal",
      "title": "Portal: export an order",
      "description": "Download one of the customer's own orders as printable HTML, CSV of the line items, or JSON.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "format": {
            "default": "html",
            "type": "string",
            "enum": [
              "json",
              "csv",
              "html"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "The exported file as text (JSON, CSV or printable HTML)"
          }
        },
        "required": [
          "filename",
          "contentType",
          "content"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.machines",
      "toolName": "portal_machines",
      "group": "portal",
      "title": "Portal: my machines",
      "description": "The customer's installed machines with serial number, model, site, status and warranty start, end and days left.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {}
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "serialNumber": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "plant",
                    "mixer",
                    "silo",
                    "feeder",
                    "power_pack"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "configuration": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "in_build",
                    "in_transit",
                    "operating",
                    "down",
                    "idle",
                    "retired"
                  ]
                },
                "siteName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteCity": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "siteState": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "commissionedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyStart": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "warrantyState": {
                  "type": "string",
                  "enum": [
                    "none",
                    "active",
                    "expiring",
                    "expired"
                  ]
                },
                "warrantyDaysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "serialNumber",
                "type",
                "model",
                "configuration",
                "options",
                "status",
                "siteName",
                "siteCity",
                "siteState",
                "commissionedOn",
                "warrantyStart",
                "warrantyEnd",
                "warrantyState",
                "warrantyDaysLeft",
                "orderId"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.documents",
      "toolName": "portal_documents",
      "group": "portal",
      "title": "Portal: my documents",
      "description": "Documents shared with the customer: quotes, signed quotes, drawings, manuals and inspection reports on their own orders and machines.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "kind": {
            "type": "string",
            "enum": [
              "signed_quote",
              "quote",
              "purchase_order",
              "drawing",
              "manual",
              "inspection_report",
              "photo",
              "training_record",
              "invoice",
              "email_attachment",
              "export",
              "other"
            ]
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signed_quote",
                    "quote",
                    "purchase_order",
                    "drawing",
                    "manual",
                    "inspection_report",
                    "photo",
                    "training_record",
                    "invoice",
                    "email_attachment",
                    "export",
                    "other"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "orderId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "orderNumber": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "kind",
                "title",
                "filename",
                "contentType",
                "sizeBytes",
                "createdAt",
                "orderId",
                "orderNumber"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.document_link",
      "toolName": "portal_document_link",
      "group": "portal",
      "title": "Portal: open a document",
      "description": "A 15-minute signed link to one of the customer's own documents. Not found if the document belongs to another account or is not shared with customers.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "disposition": {
            "default": "inline",
            "type": "string",
            "enum": [
              "inline",
              "attachment"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "url": {
            "type": "string",
            "description": "Absolute URL that opens the file without signing in; valid for 15 minutes"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "UTC timestamp, ISO 8601 with Z"
          },
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "documentId",
          "url",
          "expiresAt",
          "filename",
          "contentType"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.request_service",
      "toolName": "portal_request_service",
      "group": "portal",
      "title": "Portal: request service",
      "description": "The customer asks for service on one of their own machines. Opens a service ticket for Cemco (source portal) and emails a confirmation. Saying the plant is down sets priority down, which marks the machine down.",
      "kind": "write",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "title": {
            "type": "string",
            "minLength": 3,
            "maxLength": 200,
            "description": "Short summary of the problem"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "plantDown": {
            "default": false,
            "description": "The machine cannot produce",
            "type": "boolean"
          },
          "category": {
            "default": "other",
            "type": "string",
            "enum": [
              "mechanical",
              "electrical",
              "controls",
              "hydraulic",
              "pneumatic",
              "structural",
              "calibration",
              "operator_training",
              "other"
            ]
          },
          "preferredContact": {
            "description": "Best phone number or time to reach them",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "machineId",
          "title"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ticket": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "ticketNumber": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category": {
                "type": "string",
                "enum": [
                  "mechanical",
                  "electrical",
                  "controls",
                  "hydraulic",
                  "pneumatic",
                  "structural",
                  "calibration",
                  "operator_training",
                  "other"
                ]
              },
              "priority": {
                "type": "string",
                "enum": [
                  "low",
                  "normal",
                  "high",
                  "down"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "new",
                  "diagnosing",
                  "parts_on_order",
                  "scheduled",
                  "waiting_on_customer",
                  "resolved",
                  "follow_up_complete"
                ]
              },
              "statusLabel": {
                "type": "string"
              },
              "machineId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "machineSerialNumber": {
                "type": "string"
              },
              "machineModel": {
                "type": "string"
              },
              "openedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "scheduledFor": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolvedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resolution": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "ticketNumber",
              "title",
              "description",
              "category",
              "priority",
              "status",
              "statusLabel",
              "machineId",
              "machineSerialNumber",
              "machineModel",
              "openedAt",
              "scheduledFor",
              "resolvedAt",
              "resolution"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ticket"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.tickets",
      "toolName": "portal_tickets",
      "group": "portal",
      "title": "Portal: my service requests",
      "description": "Service tickets on the customer's own machines with their current status.",
      "kind": "read",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "open": {
            "type": "boolean"
          },
          "machineId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "ticketNumber": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "mechanical",
                    "electrical",
                    "controls",
                    "hydraulic",
                    "pneumatic",
                    "structural",
                    "calibration",
                    "operator_training",
                    "other"
                  ]
                },
                "priority": {
                  "type": "string",
                  "enum": [
                    "low",
                    "normal",
                    "high",
                    "down"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "new",
                    "diagnosing",
                    "parts_on_order",
                    "scheduled",
                    "waiting_on_customer",
                    "resolved",
                    "follow_up_complete"
                  ]
                },
                "statusLabel": {
                  "type": "string"
                },
                "machineId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "machineSerialNumber": {
                  "type": "string"
                },
                "machineModel": {
                  "type": "string"
                },
                "openedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "scheduledFor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolvedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolution": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "ticketNumber",
                "title",
                "description",
                "category",
                "priority",
                "status",
                "statusLabel",
                "machineId",
                "machineSerialNumber",
                "machineModel",
                "openedAt",
                "scheduledFor",
                "resolvedAt",
                "resolution"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "portal.update_profile",
      "toolName": "portal_update_profile",
      "group": "portal",
      "title": "Portal: update my contact details",
      "description": "The customer changes their own name, phone numbers and preferred contact channel.",
      "kind": "write",
      "roles": [
        "customer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "mobile": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "preferredChannel": {
            "type": "string",
            "enum": [
              "email",
              "phone",
              "text"
            ]
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "notifications.outbox",
      "toolName": "notifications_outbox",
      "group": "notifications",
      "title": "List emails sent by the CRM",
      "description": "Emails the CRM has queued or sent: order status updates, portal invites, parts shipping notices, low-stock alerts and warranty reminders, with status queued, sent, failed or skipped (skipped means outbound email is not configured). Filter by account, template or status.",
      "kind": "read",
      "roles": [
        "admin",
        "editor",
        "viewer"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "template": {
            "type": "string",
            "enum": [
              "order_stage_changed",
              "portal_invite",
              "quote_signed",
              "service_request_received",
              "ticket_status_changed",
              "parts_order_shipped",
              "low_stock_alert",
              "warranty_expiring",
              "check_in_due",
              "opportunity_handed_to_sales",
              "service_due",
              "contract_renewal",
              "accounts_not_contacted"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "failed",
              "skipped"
            ]
          },
          "limit": {
            "default": 50,
            "description": "Maximum rows to return (default 50, max 500)",
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "offset": {
            "default": 0,
            "description": "Rows to skip, for paging",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                "template": {
                  "type": "string",
                  "enum": [
                    "order_stage_changed",
                    "portal_invite",
                    "quote_signed",
                    "service_request_received",
                    "ticket_status_changed",
                    "parts_order_shipped",
                    "low_stock_alert",
                    "warranty_expiring",
                    "check_in_due",
                    "opportunity_handed_to_sales",
                    "service_due",
                    "contract_renewal",
                    "accounts_not_contacted"
                  ]
                },
                "toAddress": {
                  "type": "string"
                },
                "subject": {
                  "type": "string"
                },
                "bodyText": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "queued",
                    "sent",
                    "failed",
                    "skipped"
                  ]
                },
                "accountId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "description": "Record id (UUID)"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entityType": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "account",
                        "contact",
                        "site",
                        "order",
                        "product",
                        "machine",
                        "ticket",
                        "warranty_claim",
                        "part",
                        "parts_order",
                        "document",
                        "activity",
                        "task",
                        "check_in",
                        "opportunity",
                        "service_plan",
                        "service_contract",
                        "training_record",
                        "import_run",
                        "user",
                        "portal_invite",
                        "customer_user",
                        "calendar_feed",
                        "stock_movement",
                        "email"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entityId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                  "description": "UTC timestamp, ISO 8601 with Z"
                },
                "sentAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "UTC timestamp, ISO 8601 with Z"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "template",
                "toAddress",
                "subject",
                "bodyText",
                "status",
                "accountId",
                "entityType",
                "entityId",
                "error",
                "createdAt",
                "sentAt"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters, ignoring limit and offset"
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "offset": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "emailConfigured": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "emailConfigured"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "notifications.retry",
      "toolName": "notifications_retry",
      "group": "notifications",
      "title": "Retry a failed email",
      "description": "Queue a failed or skipped email for sending again.",
      "kind": "write",
      "roles": [
        "admin"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          }
        },
        "required": [
          "id"
        ]
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "email": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "template": {
                "type": "string",
                "enum": [
                  "order_stage_changed",
                  "portal_invite",
                  "quote_signed",
                  "service_request_received",
                  "ticket_status_changed",
                  "parts_order_shipped",
                  "low_stock_alert",
                  "warranty_expiring",
                  "check_in_due",
                  "opportunity_handed_to_sales",
                  "service_due",
                  "contract_renewal",
                  "accounts_not_contacted"
                ]
              },
              "toAddress": {
                "type": "string"
              },
              "subject": {
                "type": "string"
              },
              "bodyText": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "queued",
                  "sent",
                  "failed",
                  "skipped"
                ]
              },
              "accountId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "entityType": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "account",
                      "contact",
                      "site",
                      "order",
                      "product",
                      "machine",
                      "ticket",
                      "warranty_claim",
                      "part",
                      "parts_order",
                      "document",
                      "activity",
                      "task",
                      "check_in",
                      "opportunity",
                      "service_plan",
                      "service_contract",
                      "training_record",
                      "import_run",
                      "user",
                      "portal_invite",
                      "customer_user",
                      "calendar_feed",
                      "stock_movement",
                      "email"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "entityId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "UTC timestamp, ISO 8601 with Z"
              },
              "sentAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "description": "UTC timestamp, ISO 8601 with Z"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "template",
              "toAddress",
              "subject",
              "bodyText",
              "status",
              "accountId",
              "entityType",
              "entityId",
              "error",
              "createdAt",
              "sentAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "notifications.run_daily",
      "toolName": "notifications_run_daily",
      "group": "notifications",
      "title": "Run the daily reminders",
      "description": "Internal (cron): finds warranties entering the 60-day window, check-ins and preventive maintenance due, service contracts up for renewal, pre-season calls to schedule, expired portal invites, low stock and accounts not contacted in 90 days, and queues the matching emails and tasks. Safe to run more than once a day.",
      "kind": "write",
      "roles": [
        "system"
      ],
      "inputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "today": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          }
        }
      },
      "outputSchema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "warrantyAlerts": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "checkInReminders": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "serviceReminders": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lowStockAlerts": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "invitesExpired": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "idempotencyKeysPurged": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Idempotency keys older than a week that were forgotten"
          },
          "preSeasonCalls": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Pre-season check-ins created for the coming season"
          },
          "contractRenewals": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Service contract renewal reminders queued"
          },
          "notContactedDigests": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Weekly digests of accounts not contacted in 90 days queued"
          }
        },
        "required": [
          "warrantyAlerts",
          "checkInReminders",
          "serviceReminders",
          "lowStockAlerts",
          "invitesExpired",
          "idempotencyKeysPurged",
          "preSeasonCalls",
          "contractRenewals",
          "notContactedDigests"
        ],
        "additionalProperties": false
      }
    }
  ]
}