Skip to main content
Glama

get_network_activity

Retrieve captured network requests and responses for a Firefox tab, filtered by type (XHR, WebSocket, Fetch) and limited by count. Use this tool to monitor and debug network activity during browser automation.

Instructions

Get captured network requests and responses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoall
limitNo
sinceNo
tabIdNo

Implementation Reference

  • The core handler function for the 'get_network_activity' tool. It retrieves network activity from the tab's buffer, applies filters for time (since), type (filter), and limit, then returns a JSON-formatted summary of recent requests and responses.
    async getNetworkActivity(args = {}) {
      const { tabId, since, filter = 'all', limit = 30 } = args;
      const effectiveTabId = tabId || this.activeTabId;
      
      if (!effectiveTabId || !this.networkActivity.has(effectiveTabId)) {
        return { content: [{ type: 'text', text: 'No network activity captured for this tab' }] };
      }
    
      let activity = this.networkActivity.get(effectiveTabId);
      
      if (since) {
        activity = activity.filter(item => item.timestamp >= since);
      }
      
      if (filter !== 'all') {
        switch (filter) {
          case 'xhr':
            activity = activity.filter(item => item.resourceType === 'xhr');
            break;
          case 'websocket':
            activity = activity.filter(item => item.resourceType === 'websocket');
            break;
          case 'fetch':
            activity = activity.filter(item => item.resourceType === 'fetch');
            break;
        }
      }
      
      activity = activity.slice(-limit);
    
      return {
        content: [{
          type: 'text',
          text: `Network Activity (${activity.length}):\n` + JSON.stringify(activity, null, 2)
        }]
      };
    }
  • The input schema defining parameters for the tool: tabId (specific tab), since (timestamp filter), filter (by request type), and limit (max results).
    inputSchema: {
      type: 'object',
      properties: {
        tabId: { type: 'string' },
        since: { type: 'number' },
        filter: { type: 'string', enum: ['all', 'xhr', 'websocket', 'fetch'], default: 'all' },
        limit: { type: 'number', default: 30 }
      }
    }
  • Registration of the 'get_network_activity' tool in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      name: 'get_network_activity',
      description: 'Get captured network requests and responses',
      inputSchema: {
        type: 'object',
        properties: {
          tabId: { type: 'string' },
          since: { type: 'number' },
          filter: { type: 'string', enum: ['all', 'xhr', 'websocket', 'fetch'], default: 'all' },
          limit: { type: 'number', default: 30 }
        }
      }
    },
  • Helper code in setupPageMonitoring that sets up Playwright listeners for 'request' and 'response' events to capture network activity data into the this.networkActivity Map buffer per tab, which the handler then queries.
    // Network monitoring
    page.on('request', (request) => {
      const activity = this.networkActivity.get(tabId) || [];
      activity.push({
        type: 'request',
        url: request.url(),
        method: request.method(),
        headers: request.headers(),
        resourceType: request.resourceType(),
        timestamp: Date.now()
      });
      this.networkActivity.set(tabId, activity);
    });
    
    page.on('response', (response) => {
      const activity = this.networkActivity.get(tabId) || [];
      activity.push({
        type: 'response',
        url: response.url(),
        status: response.status(),
        headers: response.headers(),
        timestamp: Date.now()
      });
      this.networkActivity.set(tabId, activity);
    });
  • Dispatch/registration case in the CallToolRequestSchema handler that calls the getNetworkActivity method when the tool is invoked.
    case 'get_network_activity':
      return await this.getNetworkActivity(args);
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It mentions 'captured' network requests, implying some monitoring or logging context, but doesn't explain how data is captured, retention policies, performance impact, or response format. This leaves significant gaps for a tool that likely interacts with system resources.

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 extremely concise at 5 words, front-loading the core functionality without any wasted text. Every word earns its place by specifying the action and target resource directly.

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 4 parameters with no schema descriptions, no annotations, and no output schema, the description is incomplete. It doesn't address parameter usage, behavioral traits, or return values, making it inadequate for a tool that likely involves complex network data retrieval in a debugging context.

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

Parameters2/5

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

With 0% schema description coverage for 4 parameters, the description provides no information about parameters like 'filter', 'limit', 'since', or 'tabId'. It doesn't explain what these control, their formats, or how they affect the output, failing to compensate for the lack of schema documentation.

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 action ('Get') and resource ('captured network requests and responses'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_all_debug_activity' or 'get_websocket_messages', which appear related to network/debugging activities.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_all_debug_activity' and 'get_websocket_messages' that might overlap in functionality, the description offers no context about distinctions, prerequisites, or appropriate scenarios for selection.

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

Related 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/JediLuke/firefox-mcp-server'

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