( schema: StaticToolSchema | undefined, args: unknown, )
| 489 | } |
| 490 | |
| 491 | const decodeStaticToolArgs = ( |
| 492 | schema: StaticToolSchema | undefined, |
| 493 | args: unknown, |
| 494 | ): Effect.Effect<unknown, unknown> => { |
| 495 | if (schema == null) return Effect.succeed(args); |
| 496 | return Effect.promise(() => Promise.resolve(schema["~standard"].validate(args))).pipe( |
| 497 | Effect.flatMap((result) => |
| 498 | "value" in result ? Effect.succeed(result.value) : Effect.fail(result), |
| 499 | ), |
| 500 | ); |
| 501 | }; |
| 502 | |
| 503 | export interface StaticToolInput< |
| 504 | TStore = unknown, |