chore: introduce modal states (#204)

This commit is contained in:
Pavel Feldman
2025-04-16 15:21:45 -07:00
committed by GitHub
parent 6054290d9a
commit cea347d067
6 changed files with 156 additions and 88 deletions

View File

@@ -17,7 +17,7 @@
import type { ImageContent, TextContent } from '@modelcontextprotocol/sdk/types';
import type { JsonSchema7Type } from 'zod-to-json-schema';
import type { Context } from '../context';
import type * as playwright from 'playwright';
export type ToolCapability = 'core' | 'tabs' | 'pdf' | 'history' | 'wait' | 'files' | 'install';
export type ToolSchema = {
@@ -26,6 +26,14 @@ export type ToolSchema = {
inputSchema: JsonSchema7Type;
};
export type FileUploadModalState = {
type: 'fileChooser';
description: string;
fileChooser: playwright.FileChooser;
};
export type ModalState = FileUploadModalState;
export type ToolResult = {
content: (ImageContent | TextContent)[];
isError?: boolean;
@@ -34,6 +42,7 @@ export type ToolResult = {
export type Tool = {
capability: ToolCapability;
schema: ToolSchema;
clearsModalState?: ModalState['type'];
handle: (context: Context, params?: Record<string, any>) => Promise<ToolResult>;
};