browser_network_requests
Capture and retrieve all network requests made after loading a webpage using Playwright MCP, enabling detailed analysis and monitoring of web interactions.
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 core handler function for the 'browser_network_requests' tool. It retrieves all network requests from the current tab using tab.requests() and adds rendered results to the response using the renderRequest helper.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 tool, including name, title, description, empty input schema (no params needed), 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/network.ts:39-45 (helper)Helper function to render a single network request (method, url, status) into a string for the response.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(' '); }
- src/tools/network.ts:47-49 (registration)Exports the defined tool for inclusion in the central tools list.export default [ requests, ];
- src/tools.ts:36-52 (registration)Central registration of all tools, including the network tools containing 'browser_network_requests', into the allTools array used by BrowserServerBackend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];