Skip to main content
Glama

browser_navigate

Directs a browser to load a specific webpage URL, enabling automated web interaction and data access through the Playwright MCP server.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to navigate to

Implementation Reference

  • The handler function for the 'browser_navigate' tool. It validates input parameters, ensures a browser tab exists, navigates to the specified URL, generates a code snippet simulating the action, and returns it.
    handle: async (context, params) => { const validatedParams = navigateSchema.parse(params); const currentTab = await context.ensureTab(); return await currentTab.run(async tab => { await tab.navigate(validatedParams.url); const code = [ `// Navigate to ${validatedParams.url}`, `await page.goto('${validatedParams.url}');`, ]; return { code }; }, { captureSnapshot, }); },
  • Zod schema defining the input for 'browser_navigate': a required 'url' string parameter.
    const navigateSchema = z.object({ url: z.string().describe('The URL to navigate to'), });
  • Default export function that returns an array of tool factories, registering 'browser_navigate' along with back and forward navigation tools.
    export default (captureSnapshot: boolean) => [ navigate(captureSnapshot), goBack(captureSnapshot), goForward(captureSnapshot), ];
  • JSON schema configuration for the 'browser_navigate' tool, including name, description, and input schema derived from Zod.
    schema: { name: 'browser_navigate', description: 'Navigate to a URL', inputSchema: zodToJsonSchema(navigateSchema), },
  • Full ToolFactory definition for 'browser_navigate', including schema and handler implementation.
    const navigate: ToolFactory = captureSnapshot => ({ capability: 'core', schema: { name: 'browser_navigate', description: 'Navigate to a URL', inputSchema: zodToJsonSchema(navigateSchema), }, handle: async (context, params) => { const validatedParams = navigateSchema.parse(params); const currentTab = await context.ensureTab(); return await currentTab.run(async tab => { await tab.navigate(validatedParams.url); const code = [ `// Navigate to ${validatedParams.url}`, `await page.goto('${validatedParams.url}');`, ]; return { code }; }, { captureSnapshot, }); }, });

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/markbustamante77/mcp'

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