browser_network_requests
Monitor and analyze all network requests made after loading a webpage to evaluate performance, resource usage, and potential accessibility impacts for WCAG compliance.
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)Handler function that retrieves all network requests from the tab since page load and adds rendered results to 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:26-31 (schema)Schema definition including name, title, description, input schema (empty object), and readOnly type.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:22-49 (registration)Tool registration using defineTabTool, including schema and handler, and export for use.const requests = defineTabTool({ capability: 'core', schema: { name: 'browser_network_requests', title: 'List network requests', description: 'Returns all network requests since loading the page', inputSchema: z.object({}), type: 'readOnly', }, handle: async (tab, params, response) => { const requests = tab.requests(); [...requests.entries()].forEach(([req, res]) => response.addResult(renderRequest(req, res))); }, }); 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(' '); } export default [ requests, ];
- src/tools/network.ts:39-45 (helper)Helper function 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(' '); }