Skip to main content
Glama
Angeluis001

Playwright MCP

by Angeluis001

browser_file_upload

Destructive

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 that executes the browser_file_upload tool. It finds the file chooser modal state, creates an action to set the files from the provided paths, and returns code, action, and other execution details.
    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 name, title, description, input parameters (paths array), 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.ts:35-50 (registration)
    Registration of the browser_file_upload tool by including the files tools factory (...files(true)) in the snapshotTools array, which is later used to provide tools to the MCP server.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...wait(true),
    ];
  • src/tools.ts:52-66 (registration)
    Registration of the browser_file_upload tool by including the files tools factory (...files(false)) in the visionTools array for vision mode.
    export const visionTools: Tool<any>[] = [
      ...common(false),
      ...console,
      ...dialogs(false),
      ...files(false),
      ...install,
      ...keyboard(false),
      ...navigate(false),
      ...network,
      ...pdf,
      ...tabs(false),
      ...testing,
      ...vision,
      ...wait(false),
    ];
Behavior3/5

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

Annotations indicate destructiveHint=true and readOnlyHint=false, which the description doesn't contradict (uploading implies mutation). The description adds that it can handle single or multiple files, which is useful context beyond annotations. However, it lacks details on permissions, rate limits, or what happens if upload fails, leaving behavioral gaps.

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 wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place by conveying essential information.

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 complexity (destructive operation with no output schema), the description is adequate but incomplete. It covers the basic action but lacks details on error handling, success criteria, or integration with sibling tools. With annotations providing safety hints, it meets minimum viability but could be more comprehensive.

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?

Schema description coverage is 100%, with the parameter 'paths' well-documented in the schema. The description adds minimal value by implying the parameter can accept multiple files, but this is already clear from the schema's array type. Baseline 3 is appropriate as the schema carries most of the burden.

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 clearly states the action ('upload') and resource ('one or multiple files'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like browser_drag or browser_fill_form, which might also involve file operations in some contexts, so it doesn't reach the highest 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 open browser), exclusions, or comparisons to sibling tools like browser_drag for file handling. This leaves the agent with minimal context for decision-making.

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

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/Angeluis001/playwright-mcp'

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