Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

browser_file_upload

Destructive

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),
    ];
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructiveHint=true (implying changes) and readOnlyHint=false (confirming it's not read-only), which the description's 'upload' action aligns with. The description adds minimal behavioral context beyond annotations—it clarifies that multiple files can be uploaded, but doesn't mention potential side effects like overwriting files, authentication needs, or rate limits. With annotations covering safety, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—'Upload one or multiple files' is front-loaded and appropriately sized for the tool's purpose. Every word contributes directly to understanding the action and scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (file upload in a browser context), annotations provide safety cues, and the schema fully covers the single parameter. However, with no output schema and a destructive operation, the description lacks details on return values, error conditions, or upload specifics (e.g., supported file types). It's minimally complete but leaves gaps for the agent to handle.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the 'paths' parameter fully documented in the schema as 'The absolute paths to the files to upload. Can be a single file or multiple files.' The description adds no additional parameter semantics beyond this, so it meets the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Upload one or multiple files' clearly states the action (upload) and resource (files), distinguishing it from sibling browser tools that perform navigation, interaction, or inspection tasks. However, it doesn't specify the upload destination or context (e.g., to a browser session or web page), which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active browser session), exclusions, or related tools for file handling in the browser context, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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