navigate
Directs a Tauri desktop application to load a specified URL in a window, enabling automated navigation for testing and interaction workflows.
Instructions
Navigate to URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL | |
| window | No | Window label (default: focused window) |
Implementation Reference
- Tool schema definition for 'navigate' with name, description, and Zod input schema (url and optional window parameters)navigate: { name: 'navigate', description: 'Navigate to URL', inputSchema: z.object({ url: z.string().describe('URL'), window: z.string().optional().describe('Window label (default: focused window)'), }), },
- Tool handler that processes navigate requests by calling socketManager.navigate() and returning the resultnavigate: async (args: { url: string; window?: string }) => { const result = await socketManager.navigate(args.url, args.window); return { content: [ { type: 'text' as const, text: result, }, ], }; },
- Actual implementation of navigate method in SocketManager that sends 'navigate' command via socket and returns success messageasync navigate(url: string, windowLabel?: string): Promise<string> { const params: Record<string, unknown> = { url }; if (windowLabel) params.window = windowLabel; const result = await this.sendCommand('navigate', params) as { success: boolean; error?: string }; if (!result.success) { throw new Error(result.error || 'Navigate failed'); } const windowInfo = windowLabel ? ` in window '${windowLabel}'` : ''; return `Navigated to ${url}${windowInfo}`; }
- packages/tauri-mcp/src/server.ts:14-23 (registration)Navigate tool registered in DEFAULT_ESSENTIAL_TOOLS array, marking it as an essential toolconst DEFAULT_ESSENTIAL_TOOLS = [ 'app_status', 'launch_app', 'stop_app', 'snapshot', 'click', 'fill', 'screenshot', 'navigate', ];
- packages/tauri-mcp/src/server.ts:112-134 (registration)Generic tool call handler registration that routes tool requests (including navigate) to their respective handlersthis.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; if (!(name in this.toolHandlers)) { throw new Error(`Unknown tool: ${name}`); } const handler = this.toolHandlers[name as ToolName]; try { return await handler(args as never); } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${(error as Error).message}`, }, ], isError: true, }; } });