Skip to main content
Glama

navigate

Direct a browser to a specified URL for automation tasks, enabling precise control over web navigation within Playwright MCP's browser automation framework.

Instructions

Navigate to a URL

Input Schema

NameRequiredDescriptionDefault
page_idNo
urlYes

Input Schema (JSON Schema)

{ "properties": { "page_id": { "type": "string" }, "url": { "type": "string" } }, "required": [ "url" ], "type": "object" }

Implementation Reference

  • The core handler logic for the 'navigate' tool within the handle_call_tool function. It retrieves the URL from arguments, validates it, selects the appropriate page, navigates to the URL using Playwright's page.goto(), and returns a confirmation message.
    if name == "navigate": url = arguments.get("url") if not url: raise ValueError("URL is required") page = get_active_page(arguments.get("page_id")) await page.goto(url) return [types.TextContent(type="text", text=f"Navigated to {url}")]
  • Registration of the 'navigate' tool in the handle_list_tools() function, including name, description, and input schema.
    types.Tool( name="navigate", description="Navigate to a URL", inputSchema={ "type": "object", "properties": { "url": {"type": "string"}, "page_id": {"type": "string"}, }, "required": ["url"], }, ),
  • Input schema definition for the 'navigate' tool, specifying required 'url' parameter and optional 'page_id'.
    inputSchema={ "type": "object", "properties": { "url": {"type": "string"}, "page_id": {"type": "string"}, }, "required": ["url"], },
  • Helper function get_active_page used by the navigate handler to retrieve the correct Page object based on page_id or default.
    def get_active_page(page_id: Optional[str] = None) -> Page: """Get the active page based on page_id or current default.""" global current_page_id if page_id is None: page_id = current_page_id if page_id not in pages: raise ValueError(f"Page not found: {page_id}") return pages[page_id]

Other Tools

Related 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/misanthropic-ai/playwrite-mcp'

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