prepareInvocation
abstract var prepareInvocation: (options: LanguageModelToolInvocationPrepareOptions<T>, token: CancellationToken) -> ProviderResult<PreparedToolInvocation>?(source)
Called once before a tool is invoked. It's recommended to implement this to customize the progress message that appears while the tool is running, and to provide a more useful message with context from the invocation input. Can also signal that a tool needs user confirmation before running, if appropriate.
Note 1: Must be free of side-effects.
Note 2: A call to
prepareInvocation
is not necessarily followed by a call toinvoke
.