invoke method

FutureOr<Object?> invoke(
  1. C context,
  2. String name,
  3. Map<String, Object?> arguments
)

Calls the tool name names with arguments — the entry a presentation uses.

A name this set does not hold is refused exactly as require refuses it, and that refusal is recorded too: a call naming a tool that does not exist is still a call, and the likeliest shape of an agent probing the surface.

Implementation

FutureOr<Object?> invoke(
  C context,
  String name,
  Map<String, Object?> arguments,
) {
  final tool = this[name];
  if (tool != null) return tool.call(context, arguments);
  return refuse(context, name, arguments, () => require(name));
}