Skip to main content
Glama
lxman

Safari MCP Server

by lxman

safari_navigate

Navigate Safari browser to a specified URL for browser automation and web interaction tasks.

Instructions

Navigate to a URL in Safari

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier
urlYesURL to navigate to

Implementation Reference

  • The main handler function for the 'safari_navigate' tool. It extracts sessionId and url from input arguments, delegates navigation to SafariDriverManager, and returns a success message.
    private async navigate(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> {
      const { sessionId, url } = args;
      
      await this.driverManager.navigateToUrl(sessionId, url);
      
      return [
        {
          type: 'text',
          text: `Successfully navigated to: ${url}`
        }
      ];
    }
  • Input schema definition and tool description for 'safari_navigate', used in the listTools response for registration.
      name: 'safari_navigate',
      description: 'Navigate to a URL in Safari',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'Session identifier' },
          url: { type: 'string', description: 'URL to navigate to' }
        },
        required: ['sessionId', 'url']
      }
    },
  • Dispatch case in the handleToolCall switch statement that routes 'safari_navigate' calls to the navigate handler.
    case 'safari_navigate':
      return await this.navigate(args);
  • Underlying helper method in SafariDriverManager that performs the actual navigation using Selenium WebDriver's driver.get(url).
    async navigateToUrl(sessionId: string, url: string): Promise<void> {
      const session = this.getSession(sessionId);
      if (!session) {
        throw new Error(`Session ${sessionId} not found`);
      }
    
      try {
        await session.driver.get(url);
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Navigation failed: ${errorMessage}`);
      }
    }

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/lxman/safari-mcp-server'

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