( schema: StaticToolSchema | undefined, args: unknown, )
| 434 | } |
| 435 | |
| 436 | const decodeStaticToolArgs = ( |
| 437 | schema: StaticToolSchema | undefined, |
| 438 | args: unknown, |
| 439 | ): Effect.Effect<unknown, unknown> => { |
| 440 | if (schema == null) return Effect.succeed(args); |
| 441 | return Effect.promise(() => Promise.resolve(schema["~standard"].validate(args))).pipe( |
| 442 | Effect.flatMap((result) => |
| 443 | "value" in result ? Effect.succeed(result.value) : Effect.fail(result), |
| 444 | ), |
| 445 | ); |
| 446 | }; |
| 447 | |
| 448 | export interface StaticToolInput< |
| 449 | TStore = unknown, |