(
definition:
| PageToolDefinition<Schema>
| ((args?: Args) => PageToolDefinition<Schema>),
)
| 360 | ): (args?: Args) => DefinedPageTool<Schema>; |
| 361 | |
| 362 | export function definePageTool< |
| 363 | Schema extends zod.ZodRawShape, |
| 364 | Args extends ParsedArguments = ParsedArguments, |
| 365 | >( |
| 366 | definition: |
| 367 | | PageToolDefinition<Schema> |
| 368 | | ((args?: Args) => PageToolDefinition<Schema>), |
| 369 | ): DefinedPageTool<Schema> | ((args?: Args) => DefinedPageTool<Schema>) { |
| 370 | if (typeof definition === 'function') { |
| 371 | return (args?: Args): DefinedPageTool<Schema> => { |
| 372 | const tool = definition(args); |
| 373 | return { |
| 374 | ...tool, |
| 375 | pageScoped: true, |
| 376 | }; |
| 377 | }; |
| 378 | } |
| 379 | |
| 380 | return { |
| 381 | ...definition, |
| 382 | pageScoped: true, |
| 383 | } as DefinedPageTool<Schema>; |
| 384 | } |
| 385 | |
| 386 | export const CLOSE_PAGE_ERROR = |
| 387 | 'The last open page cannot be closed. It is fine to keep it open.'; |
no outgoing calls
no test coverage detected