gateDefinitions
Return a function’s gates as the objects sent in its definition, after checking each one by the platform’s rules. The platform refuses a whole function when any of its gates is invalid, so this throws instead of returning gates the platform would drop. Every way to define a tool runs its gates through this check.
Parameters
gates
The function’s gates, 1 to 8 (see MAX_GATES). Each is a
SemanticGate or a plain object in the shape of the SWML
gate object.
functionName
The function’s name. Gates on a hook or built-in function name are refused; see
RESERVED_FUNCTION_NAMES.
Returns
Record<string, unknown>[] — Each gate as a plain object, deep-copied, in the
order given.
Throws Error for anything that would make the platform refuse the function, with
the platform’s reason. The message starts with the function name and, for a single
gate, the gate’s position, such as cancel_account: gate 2: .... Causes include a
reserved function name, a list that isn’t 1 to 8 gates, a gate that isn’t an
object or has an unknown key, a missing or oversized question, a threshold that
isn’t above 0 and at most 1, a missing, malformed, or oversized on_fail (a
plain-object gate needs an object with a response), oversized criteria, an
invalid visual_input or id, and a duplicate id. A gate with no
id is counted as gate_1, gate_2, and so on, by position.