get_network_activity
Retrieve captured network requests and responses for a Firefox tab, filtered by type (XHR, WebSocket, Fetch) and limited by count. Use this tool to monitor and debug network activity during browser automation.
Instructions
Get captured network requests and responses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | all | |
| limit | No | ||
| since | No | ||
| tabId | No |
Implementation Reference
- index-multi-debug.js:717-753 (handler)The core handler function for the 'get_network_activity' tool. It retrieves network activity from the tab's buffer, applies filters for time (since), type (filter), and limit, then returns a JSON-formatted summary of recent requests and responses.async getNetworkActivity(args = {}) { const { tabId, since, filter = 'all', limit = 30 } = args; const effectiveTabId = tabId || this.activeTabId; if (!effectiveTabId || !this.networkActivity.has(effectiveTabId)) { return { content: [{ type: 'text', text: 'No network activity captured for this tab' }] }; } let activity = this.networkActivity.get(effectiveTabId); if (since) { activity = activity.filter(item => item.timestamp >= since); } if (filter !== 'all') { switch (filter) { case 'xhr': activity = activity.filter(item => item.resourceType === 'xhr'); break; case 'websocket': activity = activity.filter(item => item.resourceType === 'websocket'); break; case 'fetch': activity = activity.filter(item => item.resourceType === 'fetch'); break; } } activity = activity.slice(-limit); return { content: [{ type: 'text', text: `Network Activity (${activity.length}):\n` + JSON.stringify(activity, null, 2) }] }; }
- index-multi-debug.js:303-311 (schema)The input schema defining parameters for the tool: tabId (specific tab), since (timestamp filter), filter (by request type), and limit (max results).inputSchema: { type: 'object', properties: { tabId: { type: 'string' }, since: { type: 'number' }, filter: { type: 'string', enum: ['all', 'xhr', 'websocket', 'fetch'], default: 'all' }, limit: { type: 'number', default: 30 } } }
- index-multi-debug.js:300-312 (registration)Registration of the 'get_network_activity' tool in the ListToolsRequestSchema response, including name, description, and input schema.{ name: 'get_network_activity', description: 'Get captured network requests and responses', inputSchema: { type: 'object', properties: { tabId: { type: 'string' }, since: { type: 'number' }, filter: { type: 'string', enum: ['all', 'xhr', 'websocket', 'fetch'], default: 'all' }, limit: { type: 'number', default: 30 } } } },
- index-multi-debug.js:512-536 (helper)Helper code in setupPageMonitoring that sets up Playwright listeners for 'request' and 'response' events to capture network activity data into the this.networkActivity Map buffer per tab, which the handler then queries.// Network monitoring page.on('request', (request) => { const activity = this.networkActivity.get(tabId) || []; activity.push({ type: 'request', url: request.url(), method: request.method(), headers: request.headers(), resourceType: request.resourceType(), timestamp: Date.now() }); this.networkActivity.set(tabId, activity); }); page.on('response', (response) => { const activity = this.networkActivity.get(tabId) || []; activity.push({ type: 'response', url: response.url(), status: response.status(), headers: response.headers(), timestamp: Date.now() }); this.networkActivity.set(tabId, activity); });
- index-multi-debug.js:443-444 (registration)Dispatch/registration case in the CallToolRequestSchema handler that calls the getNetworkActivity method when the tool is invoked.case 'get_network_activity': return await this.getNetworkActivity(args);