fromValue static method
Resolves a builtin tool from its wire value.
The deprecated start_subagent spelling is coerced to invokeSubagent
with a warning. Throws ArgumentError for unknown values.
Implementation
static BuiltinTools fromValue(String value) {
if (value == deprecatedStartSubagentToolName) {
_logger.warning(
"'$deprecatedStartSubagentToolName' is deprecated; use "
"'${invokeSubagent.value}' instead.",
);
return invokeSubagent;
}
for (final tool in values) {
if (tool.value == value) return tool;
}
throw ArgumentError.value(value, 'value', 'Unknown builtin tool');
}