Skip to main content
Glama

emulate_network

Simulate various network conditions like offline mode or throttled speeds (3G/4G) on a Chrome page to test performance and offline behavior.

Instructions

Emulates network conditions such as throttling or offline mode on the selected page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
throttlingOptionYesThe network throttling option to emulate. Available throttling options are: No emulation, Offline, Slow 3G, Fast 3G, Slow 4G, Fast 4G. Set to "No emulation" to disable. Set to "Offline" to simulate offline network conditions.

Implementation Reference

  • The handler function that executes the network emulation logic by applying Puppeteer network conditions based on the selected throttling option.
    handler: async (request, _response, context) => {
      const page = context.getSelectedPage();
      const conditions = request.params.throttlingOption;
    
      if (conditions === 'No emulation') {
        await page.emulateNetworkConditions(null);
        context.setNetworkConditions(null);
        return;
      }
    
      if (conditions === 'Offline') {
        await page.emulateNetworkConditions({
          offline: true,
          download: 0,
          upload: 0,
          latency: 0,
        });
        context.setNetworkConditions('Offline');
        return;
      }
    
      if (conditions in PredefinedNetworkConditions) {
        const networkCondition =
          PredefinedNetworkConditions[
            conditions as keyof typeof PredefinedNetworkConditions
          ];
        await page.emulateNetworkConditions(networkCondition);
        context.setNetworkConditions(conditions);
      }
    },
  • Zod schema defining the input parameter 'throttlingOption' with available enum values.
    schema: {
      throttlingOption: z
        .enum(throttlingOptions)
        .describe(
          `The network throttling option to emulate. Available throttling options are: ${throttlingOptions.join(', ')}. Set to "No emulation" to disable. Set to "Offline" to simulate offline network conditions.`,
        ),
    },
  • The complete tool definition and registration using defineTool, specifying name, description, annotations, schema, and handler.
    export const emulateNetwork = defineTool({
      name: 'emulate_network',
      description: `Emulates network conditions such as throttling or offline mode on the selected page.`,
      annotations: {
        category: ToolCategories.EMULATION,
        readOnlyHint: false,
      },
      schema: {
        throttlingOption: z
          .enum(throttlingOptions)
          .describe(
            `The network throttling option to emulate. Available throttling options are: ${throttlingOptions.join(', ')}. Set to "No emulation" to disable. Set to "Offline" to simulate offline network conditions.`,
          ),
      },
      handler: async (request, _response, context) => {
        const page = context.getSelectedPage();
        const conditions = request.params.throttlingOption;
    
        if (conditions === 'No emulation') {
          await page.emulateNetworkConditions(null);
          context.setNetworkConditions(null);
          return;
        }
    
        if (conditions === 'Offline') {
          await page.emulateNetworkConditions({
            offline: true,
            download: 0,
            upload: 0,
            latency: 0,
          });
          context.setNetworkConditions('Offline');
          return;
        }
    
        if (conditions in PredefinedNetworkConditions) {
          const networkCondition =
            PredefinedNetworkConditions[
              conditions as keyof typeof PredefinedNetworkConditions
            ];
          await page.emulateNetworkConditions(networkCondition);
          context.setNetworkConditions(conditions);
        }
      },
    });
  • Helper constant defining the list of available network throttling options used in the schema enum.
    const throttlingOptions: [string, ...string[]] = [
      'No emulation',
      'Offline',
      ...Object.keys(PredefinedNetworkConditions),
    ];
Behavior3/5

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

Annotations indicate readOnlyHint=false (implying mutation), which aligns with the description's 'emulates' action. The description adds context about what gets modified (network conditions on a page) and the types of conditions (throttling/offline), but doesn't detail side effects like persistence across actions or rate limits. With annotations covering the mutation hint, this is adequate but not rich.

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 that front-loads the core purpose ('Emulates network conditions') and specifies the scope ('on the selected page'). There is no wasted text, and it directly communicates the tool's function.

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

Completeness4/5

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

Given the tool's moderate complexity (mutation with one parameter), annotations provide safety context, and schema fully documents the parameter. No output schema exists, but the description doesn't need to explain return values for this action-oriented tool. It's mostly complete but could benefit from more behavioral details like effects on other tools.

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 fully documented in the schema (including enum values and descriptions). The description doesn't add extra meaning beyond the schema, such as explaining how throttling affects page behavior. Baseline 3 is appropriate when schema handles most documentation.

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 specific action ('emulates network conditions') and the resource ('on the selected page'), distinguishing it from siblings like emulate_cpu (which handles CPU throttling) and get_network_request/list_network_requests (which monitor rather than emulate). It uses precise verbs and scope.

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

Usage Guidelines3/5

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

The description implies usage for testing network effects but doesn't explicitly state when to use this tool versus alternatives like emulate_cpu or when not to use it (e.g., for non-network testing). It provides some context but lacks explicit guidance on prerequisites or comparisons.

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/SHAY5555-gif/chrome-devtools-mcp'

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