proxy_get_traffic_log
Retrieve captured HTTP/HTTPS traffic logs with filtering by domain, method, time, or result count for monitoring and analysis.
Instructions
Get captured traffic log with filtering options
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "proxy_get_traffic_log"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | No | Filter by specific domain | |
| method | No | Filter by HTTP method (GET, POST, etc.) | |
| limit | No | Maximum number of entries to return | |
| since | No | ISO timestamp to get entries since |
Implementation Reference
- src/tools/tool-handlers.js:338-355 (handler)The main handler for the proxy_get_traffic_log tool. It retrieves filtered traffic entries from the TrafficAnalyzer and formats them into a readable text log.
case 'proxy_get_traffic_log': const entries = this.trafficAnalyzer.getEntries({ domain: args.domain, method: args.method, limit: args.limit, since: args.since ? new Date(args.since) : undefined }); const logText = entries.map(entry => `[${entry.timestamp}] ${entry.method} ${entry.url} -> ${entry.statusCode} (${entry.responseTime}ms)` ).join('\n'); return { content: [{ type: "text", text: `📈 Traffic Log (${entries.length} entries)\n\n${logText || 'No traffic captured'}` }] }; - Tool definition including name, description, and input schema for validation.
proxy_get_traffic_log: { name: "proxy_get_traffic_log", description: "Get captured traffic log with filtering options", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Filter by specific domain" }, method: { type: "string", description: "Filter by HTTP method (GET, POST, etc.)" }, limit: { type: "number", description: "Maximum number of entries to return", default: 50 }, since: { type: "string", description: "ISO timestamp to get entries since" } } } }, - Core helper method that filters, sorts, and limits traffic entries based on the tool parameters. Called by the handler.
getEntries(options = {}) { let filtered = [...this.entries]; // Filter by domain if (options.domain) { filtered = filtered.filter(entry => entry.domain.includes(options.domain) ); } // Filter by method if (options.method) { filtered = filtered.filter(entry => entry.method === options.method.toUpperCase() ); } // Filter by time if (options.since) { const sinceTime = new Date(options.since).getTime(); filtered = filtered.filter(entry => new Date(entry.timestamp).getTime() >= sinceTime ); } // Sort by timestamp (newest first) filtered.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime() ); // Limit results if (options.limit) { filtered = filtered.slice(0, options.limit); } return filtered; }