Skip to main content
Glama

browser_network_requests

Capture and analyze network requests during web page interactions to monitor resource loading, API calls, and performance metrics for debugging and optimization.

Instructions

Returns all network requests since loading the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeStaticNoWhether to include successful static resources like images, fonts, scripts, etc. Defaults to false.

Implementation Reference

  • The main handler function for the 'browser_network_requests' tool, which fetches network requests from the current browser tab, formats them using renderRequest, and returns a text log via an action.
    handle: async context => { const requests = context.currentTabOrDie().requests(); const log = [...requests.entries()].map(([request, response]) => renderRequest(request, response)).join('\n'); return { code: [`// <internal code to list network requests>`], action: async () => { return { content: [{ type: 'text', text: log }] }; }, captureSnapshot: false, waitForNetwork: false, }; },
  • Schema definition for the 'browser_network_requests' tool, including 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', },
  • Exports the defined 'browser_network_requests' tool (as 'requests') for inclusion in the main tools arrays.
    export default [ requests, ];
  • Helper function used by the handler to format each network request and optional response into a concise 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(' '); }
  • src/tools.ts:35-50 (registration)
    Includes the network tools (containing 'browser_network_requests') in the snapshotTools array via spread of the network module.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Angeluis001/playwright-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server