wipeLogs
Clear all browser logs from memory to ensure data privacy and optimize performance. Part of the BrowserTools MCP for monitoring and interacting with browser activities.
Instructions
Wipe all browser logs from memory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- browser-tools-mcp/mcp-server.ts:322-340 (handler)MCP server tool registration and handler for 'wipeLogs'. Proxies a POST request to the browser server /wipelogs endpoint and returns the response message.server.tool("wipeLogs", "Wipe all browser logs from memory", async () => { return await withServerConnection(async () => { const response = await fetch( `http://${discoveredHost}:${discoveredPort}/wipelogs`, { method: "POST", } ); const json = await response.json(); return { content: [ { type: "text", text: json.message, }, ], }; }); });
- HTTP POST endpoint handler for /wipelogs that invokes the clearAllLogs helper function.app.post("/wipelogs", (req, res) => { clearAllLogs(); res.json({ status: "ok", message: "All logs cleared successfully" }); });
- Core helper function that clears all in-memory log arrays (consoleLogs, consoleErrors, networkErrors, networkSuccess, allXhr) and resets selectedElement.function clearAllLogs() { console.log("Wiping all logs..."); consoleLogs.length = 0; consoleErrors.length = 0; networkErrors.length = 0; networkSuccess.length = 0; allXhr.length = 0; selectedElement = null; console.log("All logs have been wiped"); }
- Global in-memory arrays that store browser console logs, errors, and network logs, which are cleared by wipeLogs.const consoleLogs: any[] = []; const consoleErrors: any[] = []; const networkErrors: any[] = []; const networkSuccess: any[] = []; const allXhr: any[] = [];