Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

navigate

Directs a web browser to a specific URL, enabling automated web page access for testing, scraping, or interaction tasks.

Instructions

Navigate to a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • Core handler function that performs the browser navigation using Playwright's page.goto() method.
    async navigate(url: string): Promise<void> {
      try {
        if (!this.isInitialized()) {
          throw new Error('Browser not initialized');
        }
        this.log('Navigating to', url);
        await this.state.page?.goto(url);
        this.log('Navigation complete');
      } catch (error: any) {
        console.error('Navigation error:', error);
        throw new BrowserError('Failed to navigate', 'Check if the URL is valid and accessible');
      }
    }
  • MCP tool dispatch handler in callTool that validates input and invokes the controller's navigate method.
    case 'navigate': {
      if (!args.url || typeof args.url !== 'string') {
        return {
          content: [{ type: "text", text: "URL is required" }],
          isError: true
        };
      }
      await playwrightController.navigate(args.url);
      return {
        content: [{ type: "text", text: "Navigation successful" }]
      };
    }
  • Tool schema definition including name, description, and input schema requiring a 'url' string.
    const NAVIGATE_TOOL: Tool = {
      name: "navigate",
      description: "Navigate to a URL",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string" }
        },
        required: ["url"]
      }
    };
  • src/server.ts:516-516 (registration)
    Registration of the navigate tool in the tools object passed to MCP server capabilities.
    navigate: NAVIGATE_TOOL,

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/jomon003/PlayMCP'

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