Skip to main content
Glama
lewisvoncken

Playwright MCP

by lewisvoncken

browser_network_requests

Read-only

Capture network requests during web page interactions to monitor API calls and resource loading for debugging and analysis purposes.

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. It retrieves network requests from the current browser tab, formats them using renderRequest, and returns a textual 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,
      };
    },
  • Input/output schema definition for the tool, specifying 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 tool for registration in the MCP system.
    export default [
      requests,
    ];
  • Defines the tool using defineTool, including schema and handler.
    const requests = defineTool({
      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 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,
        };
      },
    });
  • Helper function to format a network request and optional response into a 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(' ');
    }
Behavior3/5

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

Annotations already provide key behavioral hints (readOnlyHint: true, destructiveHint: false, openWorldHint: true), indicating it's a safe read operation with potentially open-ended data. The description adds context about the temporal scope ('since loading the page'), which is useful but doesn't elaborate on aspects like data format, pagination, or rate limits. With annotations covering safety, this earns a baseline score for adding some value.

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, clear sentence with no wasted words, effectively front-loading the core purpose. It's appropriately sized for a tool with one optional parameter and good annotations, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, 100% schema coverage, annotations present), the description is adequate but has gaps. It lacks output details (no output schema), usage context, and doesn't fully compensate for the absence of behavioral specifics like data format. With annotations providing safety info, it's minimally viable but not comprehensive.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'includeStatic' fully documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline score where the schema handles the heavy lifting.

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 tool's purpose with a specific verb ('Returns') and resource ('all network requests since loading the page'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like browser_console_messages or browser_snapshot, which might also provide browser activity data, so it doesn't reach the highest score.

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. It doesn't mention any prerequisites, context for usage, or comparisons to sibling tools like browser_console_messages, leaving the agent to infer usage based on the purpose alone.

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/lewisvoncken/playwright-mcp'

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