( schema: StaticToolSchema | undefined, args: unknown, )
| 470 | } |
| 471 | |
| 472 | const decodeStaticToolArgs = ( |
| 473 | schema: StaticToolSchema | undefined, |
| 474 | args: unknown, |
| 475 | ): Effect.Effect<unknown, unknown> => { |
| 476 | if (schema == null) return Effect.succeed(args); |
| 477 | return Effect.promise(() => Promise.resolve(schema["~standard"].validate(args))).pipe( |
| 478 | Effect.flatMap((result) => |
| 479 | "value" in result ? Effect.succeed(result.value) : Effect.fail(result), |
| 480 | ), |
| 481 | ); |
| 482 | }; |
| 483 | |
| 484 | export interface StaticToolInput< |
| 485 | TStore = unknown, |