Skip to main content
Glama

browser_navigate

Navigate web browsers to specified URLs for automated testing and interaction with web pages using Playwright's browser automation capabilities.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to navigate to

Implementation Reference

  • The main handler function that implements the logic for the 'browser_navigate' tool: ensures a tab is available, navigates to the specified URL using tab.navigate(), includes a snapshot in the response, and adds Playwright code snippets for reproduction.
    handle: async (context, params, response) => { const tab = await context.ensureTab(); await tab.navigate(params.url); response.setIncludeSnapshot(); response.addCode(`// Navigate to ${params.url}`); response.addCode(`await page.goto('${params.url}');`); },
  • The schema definition for the 'browser_navigate' tool, specifying the tool name, title, description, Zod input schema requiring a 'url' string, and marking it as a destructive operation.
    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 by importing the navigate module (line 24, not shown) and including it via spread operator in the allTools array, which collects all available tools for the backend.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
  • MCP server backend's callTool method that dispatches tool calls by name: finds the tool by schema.name ('browser_navigate'), invokes its handle function with context and arguments, and serializes the response.
    async callTool(schema: mcpServer.ToolSchema<any>, parsedArguments: any) { const response = new Response(this._context, schema.name, parsedArguments); const tool = this._tools.find(tool => tool.schema.name === schema.name)!; await tool.handle(this._context, parsedArguments, response); if (this._sessionLog) await this._sessionLog.log(response); return await response.serialize(); }
  • Initialization of the tool list in the BrowserServerBackend constructor by calling filteredTools(config), which includes 'browser_navigate' based on capabilities, and passes tools to Context.
    constructor(config: FullConfig, browserContextFactory: BrowserContextFactory) { this._tools = filteredTools(config); this._context = new Context(this._tools, config, browserContextFactory); }

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/nzjami/mcpPlaywright'

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