Skip to main content
Glama
lewisvoncken

Playwright MCP

by lewisvoncken

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

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

Annotations indicate destructiveHint=true and openWorldHint=true, which the description doesn't contradict. It adds that uploading can involve 'one or multiple files' and implies a file chooser fallback if paths omitted, providing some behavioral context beyond annotations. However, it lacks details on permissions, rate limits, or specific effects of the destructive operation.

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 no wasted words. It's front-loaded with the core action and resource, making it highly concise and well-structured for quick understanding.

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 open-world hint), no output schema, and rich annotations, the description is adequate but incomplete. It covers the basic purpose but lacks context on when to use, error handling, or output expectations, leaving gaps for an agent to infer.

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' fully documented in the schema. The description adds minimal semantics by implying the tool handles multiple files, but this is already covered in the schema's description. Baseline 3 is appropriate as the schema carries 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 'Upload one or multiple files' clearly states the action (upload) and resource (files), and distinguishes from sibling tools like browser_click or browser_navigate. However, it doesn't specify the upload destination or context (e.g., to a browser session), which would make it more specific.

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?

No guidance on when to use this tool versus alternatives is provided. It doesn't mention prerequisites (e.g., needing an active browser session), nor does it differentiate from potential non-browser upload tools. The description alone offers no usage context.

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

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