Skip to main content
Glama

start_monitoring

Initiate or resume monitoring of browser tabs in Firefox, capturing data types like console logs, errors, network activity, websocket messages, and performance metrics for debugging.

Instructions

Start/restart monitoring for a tab

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdNo
typesNo

Implementation Reference

  • The handler function that implements the start_monitoring tool. It sets up page monitoring listeners for console, errors, network based on types, injects WebSocket monitoring if requested, and returns a confirmation message.
    async startMonitoring(args) { 
      const { tabId, types = ['console', 'errors', 'network', 'websocket'] } = args;
      const effectiveTabId = tabId || this.activeTabId;
      const page = this.getPage(effectiveTabId);
      
      if (types.includes('console') || types.includes('errors') || types.includes('network')) {
        await this.setupPageMonitoring(page, effectiveTabId);
      }
      
      if (types.includes('websocket')) {
        await this.injectWebSocketMonitoring(page, effectiveTabId);
      }
      
      return {
        content: [{ type: 'text', text: `Monitoring started for tab '${effectiveTabId}': ${types.join(', ')}` }]
      };
    }
  • Input schema for validating arguments to the start_monitoring tool, defining tabId and optional types array.
    inputSchema: {
      type: 'object',
      properties: {
        tabId: { type: 'string' },
        types: {
          type: 'array',
          items: { type: 'string', enum: ['console', 'errors', 'network', 'websocket', 'performance'] },
          default: ['console', 'errors', 'network', 'websocket']
        }
      }
    }
  • Registration in the tool dispatch switch statement within the CallToolRequestSchema handler, routing calls to start_monitoring to the startMonitoring method.
    case 'start_monitoring':
      return await this.startMonitoring(args);
  • Tool registration object in the ListToolsRequestSchema response, defining name, description, and schema for start_monitoring.
    {
      name: 'start_monitoring',
      description: 'Start/restart monitoring for a tab',
      inputSchema: {
        type: 'object',
        properties: {
          tabId: { type: 'string' },
          types: {
            type: 'array',
            items: { type: 'string', enum: ['console', 'errors', 'network', 'websocket', 'performance'] },
            default: ['console', 'errors', 'network', 'websocket']
          }
        }
      }
    },
  • Helper function called by start_monitoring to set up console, JS error, network, and WebSocket monitoring event listeners on the page.
    // Setup monitoring listeners for a page
    async setupPageMonitoring(page, tabId) {
      console.error(`Setting up monitoring for tab: ${tabId}`);
    
      // Console monitoring
      page.on('console', (msg) => {
        const logs = this.consoleLogs.get(tabId) || [];
        logs.push({
          type: msg.type(),
          text: msg.text(),
          location: msg.location(),
          timestamp: Date.now()
        });
        this.consoleLogs.set(tabId, logs);
      });
    
      // JavaScript error monitoring
      page.on('pageerror', (error) => {
        const errors = this.jsErrors.get(tabId) || [];
        errors.push({
          message: error.message,
          stack: error.stack,
          timestamp: Date.now()
        });
        this.jsErrors.set(tabId, errors);
      });
    
      // 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);
      });
    
      // Inject WebSocket monitoring
      await this.injectWebSocketMonitoring(page, tabId);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Start/restart monitoring' but doesn't clarify what monitoring entails (e.g., real-time streaming, logging), whether it requires specific permissions, if it's destructive or read-only, or what happens on errors. This leaves significant gaps for a tool that likely involves system-level operations.

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 with a single phrase ('Start/restart monitoring for a tab'), which is front-loaded and wastes no words. Every part of the sentence directly contributes to understanding the tool's purpose, making it efficient and well-structured.

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 the complexity of a monitoring tool with 2 parameters, no annotations, no output schema, and 0% schema coverage, the description is incomplete. It lacks details on behavior, parameters, return values, and how it integrates with sibling tools, making it inadequate for safe and effective use by an AI agent.

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?

The input schema has 2 parameters with 0% description coverage, and the tool description adds no information about them. It doesn't explain what 'tabId' refers to (e.g., an identifier from 'list_tabs') or what 'types' controls (e.g., monitoring categories like 'console' or 'network'), failing to compensate for the schema's lack of 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 ('Start/restart monitoring') and the target resource ('for a tab'), which provides a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_all_debug_activity' or 'inject_debugging_helpers' that might involve monitoring-related functionality, preventing a perfect 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, such as whether it's for initial setup versus ongoing monitoring, or how it relates to sibling tools like 'get_console_logs' or 'get_network_activity'. There's only an implied context of starting monitoring, with no explicit when/when-not instructions or prerequisites.

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