Skip to main content
Glama

playwright_navigate

Direct a browser to a specified URL using Playwright automation, enabling web page interaction, content retrieval, and testing within an automated environment.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • The core handler logic for the 'playwright_navigate' tool. It navigates the Playwright page to the specified URL with optional timeout and waitUntil options, returning success or error message.
    case "playwright_navigate":
      try {
        await page!.goto(args.url, {
          timeout: args.timeout || 30000,
          waitUntil: args.waitUntil || "load"
        });
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Navigated to ${args.url} with ${args.waitUntil || "load"} wait`,
            }],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Navigation failed: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
  • The tool schema definition for 'playwright_navigate', including name, description, and input schema requiring a 'url' string.
    {
      name: "playwright_navigate",
      description: "Navigate to a URL",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string" },
        },
        required: ["url"],
      },
    },
  • Registration of the MCP CallTool request handler, which routes tool calls (including 'playwright_navigate') to the handleToolCall function in toolsHandler.ts.
    // Call tool handler
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name, request.params.arguments ?? {}, server)
    );
  • Registration of the MCP ListTools request handler, which provides the list of available tools including 'playwright_navigate'.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: tools,
    }));
  • Helper function to ensure the Playwright browser and page are launched, used by browser-requiring tools like 'playwright_navigate'.
    async function ensureBrowser() {
      if (!browser) {
        browser = await chromium.launch({ headless: false });
        const context = await browser.newContext({
          viewport: { width: 1920, height: 1080 },
          deviceScaleFactor: 1,
        });
    
        page = await context.newPage();
    
        page.on("console", (msg) => {
          const logEntry = `[${msg.type()}] ${msg.text()}`;
          consoleLogs.push(logEntry);
          // Note: server.notification is assumed to be passed in from the main server
        });
      }
      return page!;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Navigate to a URL' implies a navigation action but lacks details on behavior: it doesn't specify if it waits for page load, handles redirects, manages timeouts, or requires authentication. For a tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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 'Navigate to a URL' is extremely concise—three words that directly convey the core action. It's front-loaded with no unnecessary elaboration, making it efficient for quick understanding. Every word earns its place, though this brevity contributes to gaps in other dimensions.

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 tool's complexity (navigation in a browser context), lack of annotations, no output schema, and minimal parameter semantics, the description is incomplete. It doesn't address expected outcomes (e.g., success/failure states), error handling, or integration with sibling tools, leaving significant gaps for an AI agent to operate effectively.

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 input schema has 1 parameter with 0% description coverage, so the schema provides no semantic information. The description adds minimal value by implying the parameter is a URL, but doesn't elaborate on format constraints (e.g., must be valid HTTP/HTTPS) or usage context. Baseline is 3 due to the single parameter, but the description doesn't fully compensate for the schema's lack of detail.

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 'Navigate to a URL' clearly states the action (navigate) and target (URL), making the purpose immediately understandable. It distinguishes from siblings like 'playwright_click' or 'playwright_fill' by focusing on page navigation rather than interaction or data entry. However, it doesn't specify what 'navigate' entails beyond the basic verb.

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., requires an active browser context), exclusions, or relationships with sibling tools like 'playwright_get' (which might overlap in functionality). Without such context, the agent must 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.

Deploy Server

Other Tools

Related Tools