require method

AgentTool<C> require(
  1. String name
)

name's tool, or a refusal.

A tool another set holds but this one does not is indistinguishable from a typo, and deliberately so: no error tells a caller which call would have worked.

Implementation

AgentTool<C> require(String name) =>
    this[name] ??
    (throw AgentToolException(
      AgentToolErrorCode.invalidArgument,
      'No tool named "$name".',
      argument: 'name',
    ));