Skip to main content
Glama

stop_network_capture

Stop active network capture sessions in WebScout MCP to retrieve captured traffic data including requests, responses, WebSocket frames, and streaming information with timestamps for analysis.

Instructions

Stop the active network capture session and return all captured data. Returns comprehensive network traffic including requests, responses, WebSocket frames, and streaming data with timestamps and headers. Use this to analyze captured network activity or save data for later processing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID obtained from initialize_session

Implementation Reference

  • The primary handler function that executes the stop_network_capture tool logic: retrieves capture data from session, disables CDP monitoring, prepares comprehensive results with summary and raw data, and cleans up session storage.
    export async function stopNetworkCapture(sessionId) {
      const session = global.activeSessions?.get(sessionId);
      if (!session) {
        throw new Error(`Session ${sessionId} not found.`);
      }
    
      const captureData = session.networkCapture;
      if (!captureData) {
        throw new Error(
          `No active network capture for session ${sessionId}. Call startNetworkCapture first.`
        );
      }
    
      // Clean up CDP session
      if (captureData.cdpClient) {
        try {
          await captureData.cdpClient.send("Network.disable");
          await captureData.cdpClient.send("Fetch.disable");
          await captureData.cdpClient.detach();
        } catch (e) {
          // Ignore cleanup errors
        }
      }
    
      // Calculate capture duration
      const endTime = Date.now();
      const duration = endTime - captureData.startTime;
    
      // Prepare result
      const result = {
        sessionId,
        captureId: `capture_${captureData.startTime}`,
        duration,
        startTime: new Date(captureData.startTime).toISOString(),
        endTime: new Date(endTime).toISOString(),
        summary: {
          totalRequests: captureData.requests.length,
          totalResponses: captureData.responses.length,
          totalWsFrames: captureData.wsFrames.length,
          streamingResponses: captureData.streamingResponses.length,
        },
        options: captureData.options,
        data: {
          requests: captureData.requests,
          responses: captureData.responses,
          wsFrames: captureData.wsFrames,
          streamingResponses: captureData.streamingResponses,
        },
      };
    
      // Clean up session data
      delete session.networkCapture;
    
      return result;
    }
  • The input schema and metadata definition for the stop_network_capture tool, registered in the MCP server's listTools response.
    {
      name: "stop_network_capture",
      description:
        "Stop the active network capture session and return all captured data. Returns comprehensive network traffic including requests, responses, WebSocket frames, and streaming data with timestamps and headers. Use this to analyze captured network activity or save data for later processing.",
      inputSchema: {
        type: "object",
        properties: {
          sessionId: {
            type: "string",
            description: "Session ID obtained from initialize_session",
          },
        },
        required: ["sessionId"],
      },
    },
  • src/index.js:567-576 (registration)
    The dispatch case in the MCP CallToolRequestSchema handler that validates input and calls the stopNetworkCapture handler function.
    case "stop_network_capture": {
      const { sessionId } = args;
      if (!sessionId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "sessionId parameter is required"
        );
      }
      result = await stopNetworkCapture(sessionId);
      break;
  • Re-export of the stopNetworkCapture function from networkCapture.js, allowing centralized imports in index.js.
    export {
      startNetworkCapture,
      stopNetworkCapture,
      getNetworkCaptureStatus,
      clearNetworkCapture,
    } from "./networkCapture.js";
Behavior3/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 describes the action (stop session, return data) and the comprehensive nature of returned data (requests, responses, WebSocket frames, etc.), but does not cover aspects like error handling, permissions needed, or side effects. It adds some value but lacks depth for a mutation tool.

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 appropriately sized and front-loaded, with two sentences that efficiently convey purpose, behavior, and usage without waste. Every sentence adds value, starting with the core action and followed by context and application.

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 complexity (mutation with no annotations and no output schema), the description is fairly complete, covering what the tool does, what data it returns, and usage context. However, it could improve by detailing return format or error cases, leaving minor gaps for a tool with no structured output information.

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%, so the schema already documents the single parameter 'sessionId'. The description does not add any parameter-specific information beyond what the schema provides, such as format details or usage context. Baseline 3 is appropriate when schema handles parameter 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 tool's purpose with specific verbs ('stop', 'return') and resource ('active network capture session'), distinguishing it from siblings like 'start_network_capture' and 'get_network_capture_status'. It specifies what happens when invoked: stopping the session and returning captured data.

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?

The description provides clear context on when to use this tool ('to analyze captured network activity or save data for later processing'), but does not explicitly state when not to use it or name alternatives. It implies usage after starting a capture, but lacks explicit exclusions or sibling tool 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/pyscout/webscout-mcp'

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