browser_network_requests
Capture all network requests made by a web page after loading to analyze API calls, resource loading, and performance metrics.
Instructions
Returns all network requests since loading the page
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_network_requests"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/network.ts:33-36 (handler)The handler function that retrieves all network requests using tab.requests() 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 for the browser_network_requests 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/network.ts:22-49 (registration)The tool definition using defineTabTool and export as default array for registration.
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(' '); }