Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

playwright_navigate

Navigate to specified URLs in a browser for web automation tasks like content scraping, testing, or page interaction.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to navigate to the website specified
browserTypeNoBrowser type to use (chromium, firefox, webkit). Defaults to chromium
widthNoViewport width in pixels (default: 1280)
heightNoViewport height in pixels (default: 720)
timeoutNoNavigation timeout in milliseconds
waitUntilNoNavigation wait condition
headlessNoRun browser in headless mode (default: false)

Implementation Reference

  • The `execute` method of `NavigationTool` class implements the `playwright_navigate` tool by performing `page.goto()` navigation with error handling for browser connection issues.
    async execute(args: any, context: ToolContext): Promise<ToolResponse> {
      // Check if browser is available
      if (!context.browser || !context.browser.isConnected()) {
        // If browser is not connected, we need to reset the state to force recreation
        resetBrowserState();
        return createErrorResponse(
          "Browser is not connected. The connection has been reset - please retry your navigation."
        );
      }
    
      // Check if page is available and not closed
      if (!context.page || context.page.isClosed()) {
        return createErrorResponse(
          "Page is not available or has been closed. Please retry your navigation."
        );
      }
    
      return this.safeExecute(context, async (page) => {
        try {
          await page.goto(args.url, {
            timeout: args.timeout || 30000,
            waitUntil: args.waitUntil || "load"
          });
          
          return createSuccessResponse(`Navigated to ${args.url}`);
        } catch (error) {
          const errorMessage = (error as Error).message;
          
          // Check for common disconnection errors
          if (
            errorMessage.includes("Target page, context or browser has been closed") ||
            errorMessage.includes("Target closed") ||
            errorMessage.includes("Browser has been disconnected")
          ) {
            // Reset browser state to force recreation on next attempt
            resetBrowserState();
            return createErrorResponse(
              `Browser connection issue: ${errorMessage}. Connection has been reset - please retry your navigation.`
            );
          }
          
          // For other errors, return the standard error
          throw error;
        }
      });
    }
  • The tool definition object including name, description, and inputSchema for `playwright_navigate`.
    {
      name: "playwright_navigate",
      description: "Navigate to a URL",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "URL to navigate to the website specified" },
          browserType: { type: "string", description: "Browser type to use (chromium, firefox, webkit). Defaults to chromium", enum: ["chromium", "firefox", "webkit"] },
          width: { type: "number", description: "Viewport width in pixels (default: 1280)" },
          height: { type: "number", description: "Viewport height in pixels (default: 720)" },
          timeout: { type: "number", description: "Navigation timeout in milliseconds" },
          waitUntil: { type: "string", description: "Navigation wait condition" },
          headless: { type: "boolean", description: "Run browser in headless mode (default: false)" }
        },
        required: ["url"],
      },
    },
  • Switch case in `handleToolCall` that registers and routes `playwright_navigate` calls to the NavigationTool handler.
    case "playwright_navigate":
      return await navigationTool.execute(args, context);
  • src/tools.ts:450-452 (registration)
    `playwright_navigate` is listed in the BROWSER_TOOLS array, used for conditional browser launch and tool categorization.
    export const BROWSER_TOOLS = [
      "playwright_navigate",
      "playwright_screenshot",
  • Code generation helper in PlaywrightGenerator that converts `playwright_navigate` actions into test code steps.
    case 'playwright_navigate':
      return this.generateNavigateStep(parameters);
    case 'playwright_fill':
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Navigate to a URL' implies a browser action but doesn't disclose key traits: it launches a browser session (implied by parameters like browserType and headless), may create a new page, has timeout controls, and likely returns navigation status. For a tool with 7 parameters and no annotations, this is insufficient detail on behavior.

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. It's front-loaded and appropriately sized for a simple action, though it could be more informative. Every word earns its place, making it highly concise.

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

Completeness2/5

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

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what happens after navigation (e.g., page state, return values), prerequisites, or error handling. For a browser automation tool with multiple configuration options, this leaves significant gaps for an agent.

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%, so the schema fully documents all 7 parameters (e.g., url, browserType, timeout). The description adds no additional meaning beyond the schema, such as explaining parameter interactions or default behaviors. Baseline 3 is appropriate when the schema does all the work.

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

Purpose3/5

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

The description 'Navigate to a URL' clearly states the verb ('navigate') and resource ('URL'), but it's vague about scope and differentiation. It doesn't specify this is for browser automation (implied by the 'playwright_' prefix) or distinguish it from similar tools like 'playwright_get' (which might also navigate). The purpose is understandable but lacks specificity.

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. With sibling tools like 'playwright_get' (which might serve a similar navigation function) and no explicit context or exclusions mentioned, an agent must infer usage from the name alone. This is minimal guidance.

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/devskido/customed-playwright'

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