navigate_back
Go back to the previous page in browser history. Avoid navigating directly to the previous URL for a more efficient action.
Instructions
Go back to the previous page in browser history. Use this instead of navigating to the previous URL directly when possible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No | Target tab ID (defaults to currently active tab) | |
| apiKey | No | API key for authentication if enabled |
Implementation Reference
- src/tools/navigation.ts:30-49 (handler)The tool handler for 'navigate_back'. Registers an MCP tool that sends a 'navigate_back' command via WebSocketBridge. Accepts optional tabId and apiKey parameters, returns success/error response.
server.tool( 'navigate_back', 'Go back to the previous page in browser history. Use this instead of navigating to the previous URL directly when possible.', { tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'navigate_back', params: {}, tabId, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: 'Navigated back' }] }; } ); - src/tools/navigation.ts:33-36 (schema)Input schema for 'navigate_back': tabId (optional number) and apiKey (optional string) validated with Zod.
{ tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, - src/tools/navigation.ts:30-49 (registration)Registration of 'navigate_back' tool via server.tool() call within registerNavigationTools function.
server.tool( 'navigate_back', 'Go back to the previous page in browser history. Use this instead of navigating to the previous URL directly when possible.', { tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'navigate_back', params: {}, tabId, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: 'Navigated back' }] }; } ); - src/tools/index.ts:30-30 (registration)registerNavigationTools is invoked from registerAllTools, which wires up all tool groups including navigation tools.
registerNavigationTools(server, bridge);