proxy_clear_traffic_log
Clear web proxy traffic logs to remove browsing history and monitoring data, with options for specific domains and confirmation to prevent accidental deletion.
Instructions
Clear the traffic log
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | No | Clear logs for specific domain only | |
| confirm | Yes | Confirmation flag to prevent accidental deletion |
Implementation Reference
- src/tools/tool-handlers.js:371-385 (handler)Handler implementation that checks for confirmation flag, calls trafficAnalyzer.clearEntries with optional domain filter, and returns a success message with cleared and remaining entry counts.case 'proxy_clear_traffic_log': if (!args.confirm) { return { error: "Confirmation required to clear traffic log", isError: true }; } const cleared = this.trafficAnalyzer.clearEntries(args.domain); return { content: [{ type: "text", text: `🗑️ Traffic log cleared\nEntries removed: ${cleared}\nRemaining: ${this.trafficAnalyzer.getEntryCount()}` }] };
- Tool definition including name, description, and input schema requiring 'confirm' boolean (with optional 'domain' string). Used for validation and listing.proxy_clear_traffic_log: { name: "proxy_clear_traffic_log", description: "Clear the traffic log", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Clear logs for specific domain only" }, confirm: { type: "boolean", description: "Confirmation flag to prevent accidental deletion", default: false } }, required: ["confirm"] } },
- Core helper method in TrafficAnalyzer class that clears all or domain-specific traffic log entries from memory, resets stats if all cleared, and returns the number of removed entries.clearEntries(domain = null) { let cleared = 0; if (domain) { const originalLength = this.entries.length; this.entries = this.entries.filter(entry => !entry.domain.includes(domain) ); cleared = originalLength - this.entries.length; } else { cleared = this.entries.length; this.entries = []; this.stats = { totalRequests: 0, totalResponseTime: 0, domainsTracked: new Set(), startTime: new Date() }; } return cleared; }