Extract tool calls type from an agent's tools.
Converts the tools array to a discriminated union of tool calls.
This handles both tuple types (e.g., readonly [Tool1, Tool2]) and
array-of-union types (e.g., readonly (Tool1 | Tool2)[]) which is how
createAgent captures tool types.
Extract tool calls type from an agent's tools. Converts the tools array to a discriminated union of tool calls.
This handles both tuple types (e.g.,
readonly [Tool1, Tool2]) and array-of-union types (e.g.,readonly (Tool1 | Tool2)[]) which is howcreateAgentcaptures tool types.