browser_network_requests
Capture and analyze all network requests made after loading a webpage to monitor activity, debug issues, or optimize performance using Playwright automation.
Instructions
Returns all network requests since loading the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/network.ts:33-36 (handler)The handler function that implements the core logic of the 'browser_network_requests' tool by fetching all network requests from the tab and rendering them into the response.handle: async (tab, params, response) => { const requests = tab.requests(); [...requests.entries()].forEach(([req, res]) => response.addResult(renderRequest(req, res))); },
- src/tools/network.ts:25-31 (schema)The schema definition for the 'browser_network_requests' tool, specifying its name, title, description, empty input schema, and readOnly type.schema: { 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 the browser_network_requests tool (via the 'network' module) into the central allTools array, which provides tools to the MCP server backend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/tools/network.ts:39-45 (helper)Helper function used by the handler to format a network request and optional response into a readable 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(' '); }