( input: StaticToolInput<TStore, TInputSchema>, )
| 407 | } |
| 408 | |
| 409 | export const tool = < |
| 410 | TStore = unknown, |
| 411 | TInputSchema extends StaticToolSchema | undefined = StaticToolSchema | undefined, |
| 412 | >( |
| 413 | input: StaticToolInput<TStore, TInputSchema>, |
| 414 | ): StaticToolDecl<TStore> => ({ |
| 415 | name: input.name, |
| 416 | description: input.description, |
| 417 | inputSchema: input.inputSchema, |
| 418 | outputSchema: input.outputSchema, |
| 419 | annotations: input.annotations, |
| 420 | handler: ({ args, ctx, elicit }) => |
| 421 | decodeStaticToolArgs(input.inputSchema, args).pipe( |
| 422 | Effect.flatMap((decoded) => |
| 423 | input.execute( |
| 424 | decoded as TInputSchema extends StaticToolSchema |
| 425 | ? StandardSchemaV1.InferOutput<TInputSchema> |
| 426 | : unknown, |
| 427 | { ctx, elicit }, |
| 428 | ), |
| 429 | ), |
| 430 | ), |
| 431 | }); |
| 432 | |
| 433 | export interface StaticSourceDecl<TStore = unknown> { |
| 434 | readonly id: string; |
no test coverage detected