browser_file_upload
Upload single or multiple files directly through a browser interface. Ideal for automating file uploads in web applications during testing with Playwright and Cloudflare integration.
Instructions
Upload one or multiple files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | The absolute paths to the files to upload. Can be a single file or multiple files. |
Implementation Reference
- src/tools/files.ts:33-53 (handler)Handler function that locates the file chooser modal, sets the specified file paths, clears the modal state, and returns execution details including code comment, action, and network wait flag.handle: async (context, params) => { const modalState = context.modalStates().find(state => state.type === 'fileChooser'); if (!modalState) throw new Error('No file chooser visible'); const code = [ `// <internal code to chose files ${params.paths.join(', ')}`, ]; const action = async () => { await modalState.fileChooser.setFiles(params.paths); context.clearModalState(modalState); }; return { code, action, captureSnapshot, waitForNetwork: true, }; },
- src/tools/files.ts:23-31 (schema)Schema defining the tool name 'browser_file_upload', title, description, input schema expecting an array of file paths, and destructive type.schema: { name: 'browser_file_upload', title: 'Upload files', description: 'Upload one or multiple files', inputSchema: z.object({ paths: z.array(z.string()).describe('The absolute paths to the files to upload. Can be a single file or multiple files.'), }), type: 'destructive', },
- src/tools/files.ts:57-59 (registration)Exports a factory function that returns the browser_file_upload tool instance, used for registration in the tools list.export default (captureSnapshot: boolean) => [ uploadFile(captureSnapshot), ];