browser_network_requests
Capture and analyze network requests during web page interactions to monitor API calls and resource loading for debugging and testing purposes.
Instructions
Returns all network requests since loading the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeStatic | No | Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false. |
Implementation Reference
- src/tools/network.ts:33-36 (handler)The handler function for 'browser_network_requests' that lists all network requests since page load by calling tab.requests() and rendering each with renderRequest.handle: async (tab, params, response) => { const requests = tab.requests(); [...requests.entries()].forEach(([req, res]) => response.addResult(renderRequest(req, res))); },
- src/tools/network.ts:26-31 (schema)Schema definition including name, title, description, empty input schema, and readOnly type for the tool.name: 'browser_network_requests', title: 'List network requests', description: 'Returns all network requests since loading the page', inputSchema: z.object({}), type: 'readOnly', },
- src/tools.ts:36-52 (registration)Registration of all tools including network tools (which contains browser_network_requests) into the allTools export array used for tool availability.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/tools.ts:25-25 (registration)Import statement for network tools module containing browser_network_requests.import network from './tools/network.js';
- src/tools/network.ts:39-45 (helper)Helper function to render a network request and response into a formatted string.function renderRequest(request: playwright.Request, response: playwright.Response | null) { const result: string[] = []; result.push(`[${request.method().toUpperCase()}] ${request.url()}`); if (response) result.push(`=> [${response.status()}] ${response.statusText()}`); return result.join(' '); }