( schema: StaticToolSchema | undefined, args: unknown, )
| 502 | } |
| 503 | |
| 504 | const decodeStaticToolArgs = ( |
| 505 | schema: StaticToolSchema | undefined, |
| 506 | args: unknown, |
| 507 | ): Effect.Effect<unknown, unknown> => { |
| 508 | if (schema == null) return Effect.succeed(args); |
| 509 | return Effect.promise(() => Promise.resolve(schema["~standard"].validate(args))).pipe( |
| 510 | Effect.flatMap((result) => |
| 511 | "value" in result ? Effect.succeed(result.value) : Effect.fail(result), |
| 512 | ), |
| 513 | ); |
| 514 | }; |
| 515 | |
| 516 | export interface StaticToolInput< |
| 517 | TStore = unknown, |