Skip to main content
Glama
Angeluis001

Playwright MCP

by Angeluis001

browser_network_requests

Read-only

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),
    ];

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.0
    • addedInput schema / properties / includeStatic
      Added value: +{
      +  "default": false,
      +  "description": "Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.",
      +  "type": "boolean"
      +}
  2. First observed

TDQS

B3.3/5.0
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.