Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

getNetworkRequests

Capture and retrieve all network requests generated by a web page for debugging, monitoring, or analysis in browser automation workflows using Playwright.

Instructions

Get network requests made by the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that sets up Playwright listeners for network requests and responses, collects request data (url, method, status), and returns the list.
    async getNetworkRequests(): Promise<Array<{url: string, method: string, status?: number}>> { try { if (!this.isInitialized() || !this.state.page) { throw new Error('Browser not initialized'); } this.log('Getting network requests'); const requests: Array<{url: string, method: string, status?: number}> = []; // Listen to request events this.state.page.on('request', request => { requests.push({ url: request.url(), method: request.method() }); }); this.state.page.on('response', response => { const request = requests.find(req => req.url === response.url()); if (request) { request.status = response.status(); } }); this.log('Network requests retrieved'); return requests; } catch (error: any) { console.error('Get network requests error:', error); throw new BrowserError('Failed to get network requests', 'Network monitoring error'); } }
  • Tool schema definition with name, description, and empty input schema (no parameters required).
    const GET_NETWORK_REQUESTS_TOOL: Tool = { name: "getNetworkRequests", description: "Get network requests made by the page", inputSchema: { type: "object", properties: {}, required: [] } };
  • src/server.ts:545-545 (registration)
    Registration of the tool in the tools object/map used by the MCP server.
    getNetworkRequests: GET_NETWORK_REQUESTS_TOOL,
  • Server-side dispatch handler that calls the controller's getNetworkRequests method and formats the response for MCP.
    case 'getNetworkRequests': { const requests = await playwrightController.getNetworkRequests(); return { content: [{ type: "text", text: JSON.stringify(requests, null, 2) }] }; }
  • src/server.ts:562-563 (registration)
    Server initialization registers the tools object containing getNetworkRequests.
    tools, },

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/jomon003/PlayMCP'

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