Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

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
NameRequiredDescriptionDefault
pathsYesThe absolute paths to the files to upload. Can be a single file or multiple files.

Implementation Reference

  • 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, }; },
  • 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', },
  • 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), ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cloudflare/playwright-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server