Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

getNetworkRequests

Retrieve all network requests made by a web page during automation, enabling monitoring of API calls, resource loading, and traffic analysis for web scraping and testing workflows.

Instructions

Get network requests made by the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function in PlaywrightController that initializes empty requests array and sets up 'request' and 'response' event listeners on the page to capture URL, method, and status of network requests.
    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');
      }
    }
  • Defines the MCP tool schema: name, description, and input schema (empty object, no required parameters).
    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)
    Registers the getNetworkRequests tool in the tools dictionary, which is provided to the MCP server's capabilities.
    getNetworkRequests: GET_NETWORK_REQUESTS_TOOL,
  • src/server.ts:906-911 (registration)
    In the callTool request handler, the switch case that calls playwrightController.getNetworkRequests() and returns the result as JSON text content.
    case 'getNetworkRequests': {
      const requests = await playwrightController.getNetworkRequests();
      return {
        content: [{ type: "text", text: JSON.stringify(requests, null, 2) }]
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits like whether it returns real-time or historical requests, format of output, or any limitations. This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, clearly front-loaded with the core action. It's appropriately sized for a simple tool with no parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'network requests' includes (e.g., HTTP requests, timing), the return format, or any behavioral context, leaving gaps for a tool that likely returns complex data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no parameters are required, aligning with the schema. Baseline is 4 for 0 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('network requests made by the page'), making the purpose understandable. However, it doesn't distinguish this from sibling tools like 'getConsoleMessages' or 'getScripts', which also retrieve specific page data, so it lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as other 'get' tools for different page elements. It implies usage in a browser context but offers no explicit when/when-not rules or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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