navigate_reload
Refresh the current page to update content when it is stuck or outdated, bypassing cache if needed.
Instructions
Refresh the current page. Use this if the page seems stuck, outdated, or needs fresh data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ignoreCache | No | Set to true to force reload from server (skips browser cache) | |
| tabId | No | Target tab ID (defaults to currently active tab) | |
| apiKey | No | API key for authentication if enabled |
Implementation Reference
- src/tools/navigation.ts:80-93 (handler)The handler function for the 'navigate_reload' tool. Sends a 'navigate_reload' command via WebSocket bridge with optional ignoreCache, tabId, and apiKey parameters. Returns success text 'Page reloaded' or error message.
async ({ ignoreCache, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'navigate_reload', params: { ignoreCache }, tabId, apiKey, timeout: LONG_TIMEOUT, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: 'Page reloaded' }] }; } ); - src/tools/navigation.ts:72-79 (schema)The schema (input type definitions) for 'navigate_reload'. Defines optional parameters: ignoreCache (boolean), tabId (number), and apiKey (string).
server.tool( 'navigate_reload', 'Refresh the current page. Use this if the page seems stuck, outdated, or needs fresh data.', { ignoreCache: z.boolean().optional().describe('Set to true to force reload from server (skips browser cache)'), 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:72-94 (registration)Registration of 'navigate_reload' as an MCP tool via server.tool() with description 'Refresh the current page.' Inside the registerNavigationTools function which is called from src/tools/index.ts.
server.tool( 'navigate_reload', 'Refresh the current page. Use this if the page seems stuck, outdated, or needs fresh data.', { ignoreCache: z.boolean().optional().describe('Set to true to force reload from server (skips browser cache)'), 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 ({ ignoreCache, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'navigate_reload', params: { ignoreCache }, tabId, apiKey, timeout: LONG_TIMEOUT, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: 'Page reloaded' }] }; } ); } - src/websocket-bridge.ts:7-63 (helper)The WebSocketBridge.sendCommand() method used by the handler to dispatch the 'navigate_reload' command to the Chrome extension.
private pending = new Map<string, PendingRequest>(); private port: number; constructor(port: number) { this.port = port; this.wss = new WebSocketServer({ port }); this.wss.on('connection', (ws) => { if (this.client) { this.client.close(); } this.client = ws; console.error(`[MCP Bridge] Extension connected on port ${this.port}`); ws.on('message', (data) => { try { const message = JSON.parse(data.toString()); if (message.type === 'response' && message.requestId) { const pending = this.pending.get(message.requestId); if (pending) { clearTimeout(pending.timer); this.pending.delete(message.requestId); pending.resolve({ success: message.success, data: message.data, error: message.error, }); } } } catch (err) { console.error('[MCP Bridge] Failed to parse message:', err); } }); ws.on('close', () => { console.error('[MCP Bridge] Extension disconnected'); if (this.client === ws) { this.client = null; } this.rejectAllPending('Extension disconnected'); }); ws.on('error', (err) => { console.error('[MCP Bridge] WebSocket error:', err.message); }); }); this.wss.on('listening', () => { console.error(`[MCP Bridge] WebSocket server listening on port ${this.port}`); }); } isConnected(): boolean { return this.client !== null && this.client.readyState === WebSocket.OPEN; } async sendCommand(cmd: BridgeCommand): Promise<BridgeResponse> { - src/types.ts:24-25 (helper)LONG_TIMEOUT constant (60s) used as the timeout for navigate_reload, ensuring the page has enough time to reload.
export const DEFAULT_TIMEOUT = 30_000; export const LONG_TIMEOUT = 60_000;