Skip to main content
Glama

wait_for_network_idle

Read-only

Wait for network activity to settle (no connections for 500ms). Returns idle state confirmation and actual wait duration. Useful for AJAX calls or dynamic content loading.

Instructions

Wait for network activity to settle. Waits until there are no network connections for at least 500ms. Better than fixed delays when waiting for AJAX calls or dynamic content loading. Returns actual wait duration and confirmation of idle state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNoMaximum time to wait in milliseconds (default: 10000)

Implementation Reference

  • The execute method that calls page.waitForLoadState('networkidle') to wait for network activity to settle, returning duration and success/error info.
      async execute(args: WaitForNetworkIdleArgs, context: ToolContext): Promise<ToolResponse> {
        return this.safeExecute(context, async (page) => {
          const { timeout = 10000 } = args;
    
          const startTime = Date.now();
    
          try {
            // Wait for network to be idle (no network connections for at least 500ms)
            await page.waitForLoadState('networkidle', { timeout });
    
            const duration = Date.now() - startTime;
    
            return {
              content: [{
                type: 'text',
                text: `✓ Network idle after ${duration}ms, 0 pending requests`
              }],
              isError: false,
            };
          } catch (error) {
            const duration = Date.now() - startTime;
            const errorMessage = error instanceof Error ? error.message : String(error);
    
            return {
              content: [{
                type: 'text',
                text: `✗ Timeout after ${duration}ms waiting for network idle\nError: ${errorMessage}`
              }],
              isError: true,
            };
          }
        });
      }
    }
  • TypeScript interface defining the args for wait_for_network_idle: optional timeout number.
    export interface WaitForNetworkIdleArgs {
      timeout?: number;
    }
  • WaitForNetworkIdleTool is registered in the BROWSER_TOOL_CLASSES array.
    // Waiting (2)
    WaitForElementTool,
    WaitForNetworkIdleTool,
  • Import statement for WaitForNetworkIdleTool in the registration file.
    import { WaitForNetworkIdleTool } from './waiting/wait_for_network_idle.js';
  • getMetadata method providing the tool's name, description, and input schema definition.
    static getMetadata(sessionConfig?: SessionConfig): ToolMetadata {
      return {
        name: "wait_for_network_idle",
        description: "Wait for network activity to settle. Waits until there are no network connections for at least 500ms. Better than fixed delays when waiting for AJAX calls or dynamic content loading. Returns actual wait duration and confirmation of idle state.",
        annotations: ANNOTATIONS.readOnly,
        inputSchema: {
          type: "object",
          properties: {
            timeout: {
              type: "number",
              description: "Maximum time to wait in milliseconds (default: 10000)"
            }
          },
          required: [],
        },
      };
    }
Behavior4/5

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

Annotations already indicate readOnlyHint=true, and the description adds behavioral details: waits for 500ms idle, returns actual wait duration and idle state. No side effects disclosed, but it's consistent with annotations.

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?

Three sentences, front-loaded with purpose, no wasted words. All information is relevant and necessary.

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

Completeness5/5

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

For a simple tool with one parameter and no output schema, the description comprehensively covers its operation, return values, and use case. No gaps.

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 a clear description for the timeout parameter. The tool description does not add additional parameter details beyond what the schema provides.

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

Purpose5/5

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

The description clearly states the tool waits for network activity to settle with a specific condition (no connections for 500ms). It distinguishes itself from sibling tools like wait_for_element and fixed delays.

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

Usage Guidelines4/5

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

It explicitly says 'Better than fixed delays when waiting for AJAX calls or dynamic content loading,' which provides clear guidance on when to use it. However, it does not mention when not to use or compare with other waiting strategies.

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/antonzherdev/mcp-web-inspector'

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