Skip to main content
Glama
lewisvoncken

Playwright MCP

by lewisvoncken

browser_navigate

Direct a web browser to a specific URL using Playwright MCP's automation capabilities for web page interaction.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to navigate to

Implementation Reference

  • The execute function (handler) for the browser_navigate tool. It ensures a tab is available, navigates to the specified URL, generates a Playwright code snippet, and configures the response with no network wait.
    handle: async (context, params) => {
      const tab = await context.ensureTab();
      await tab.navigate(params.url);
    
      const code = [
        `// Navigate to ${params.url}`,
        `await page.goto('${params.url}');`,
      ];
    
      return {
        code,
        captureSnapshot,
        waitForNetwork: false,
      };
    },
  • Input/output schema definition for the browser_navigate tool, defining the name, title, description, input parameters (url: string), and destructive type.
    schema: {
      name: 'browser_navigate',
      title: 'Navigate to a URL',
      description: 'Navigate to a URL',
      inputSchema: z.object({
        url: z.string().describe('The URL to navigate to'),
      }),
      type: 'destructive',
    },
  • src/tools.ts:36-52 (registration)
    Registration of the browser_navigate tool as part of the snapshotTools array by spreading the result of navigate(true), which includes the tool.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...video,
      ...wait(true),
    ];
  • src/tools.ts:54-69 (registration)
    Registration of the browser_navigate tool as part of the visionTools array by spreading the result of navigate(false), which includes the tool.
    export const visionTools: Tool<any>[] = [
      ...common(false),
      ...console,
      ...dialogs(false),
      ...files(false),
      ...install,
      ...keyboard(false),
      ...navigate(false),
      ...network,
      ...pdf,
      ...tabs(false),
      ...testing,
      ...video,
      ...vision,
      ...wait(false),
    ];

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