* Similar to `build` but never throws. * @param params The raw, untrusted parameters from the model. * @returns A `ToolInvocation` instance.
(
params: TParams,
)
| 208 | * @returns A `ToolInvocation` instance. |
| 209 | */ |
| 210 | private silentBuild( |
| 211 | params: TParams, |
| 212 | ): ToolInvocation<TParams, TResult> | Error { |
| 213 | try { |
| 214 | return this.build(params); |
| 215 | } catch (e) { |
| 216 | if (e instanceof Error) { |
| 217 | return e; |
| 218 | } |
| 219 | return new Error(String(e)); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * A convenience method that builds and executes the tool in one step. |