Skip to main content
Glama

browser_file_upload

Upload files to web forms during browser automation. Specify file paths to simulate user file selection in automated web interactions.

Instructions

Upload one or multiple files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsNoThe absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.

Implementation Reference

  • The handler function for the browser_file_upload tool. It finds the file chooser modal, sets the files using the provided paths, and returns an action to execute along with code and snapshot instructions.
    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, };
  • Input schema and metadata for the browser_file_upload tool, defining the expected 'paths' parameter as an array of strings.
    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', },
  • The tool is registered by exporting a factory function that returns the uploadFile tool instance.
    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/lewisvoncken/playwright-mcp'

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