( schema: StaticToolSchema | undefined, args: unknown, )
| 453 | } |
| 454 | |
| 455 | const decodeStaticToolArgs = ( |
| 456 | schema: StaticToolSchema | undefined, |
| 457 | args: unknown, |
| 458 | ): Effect.Effect<unknown, unknown> => { |
| 459 | if (schema == null) return Effect.succeed(args); |
| 460 | return Effect.promise(() => Promise.resolve(schema["~standard"].validate(args))).pipe( |
| 461 | Effect.flatMap((result) => |
| 462 | "value" in result ? Effect.succeed(result.value) : Effect.fail(result), |
| 463 | ), |
| 464 | ); |
| 465 | }; |
| 466 | |
| 467 | export interface StaticToolInput< |
| 468 | TStore = unknown, |