Skip to main content
Glama

clear_network_capture

Clear captured network data to prevent memory issues while keeping the capture session active for continuous monitoring.

Instructions

Clear all captured network data without stopping the capture session. Resets request/response buffers while keeping capture active. Useful for long-running captures where you want to periodically clear old data to prevent memory issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID obtained from initialize_session

Implementation Reference

  • The core handler function that clears the captured network data (requests, responses, WS frames, streaming responses) for the given session ID without stopping the ongoing capture.
    export async function clearNetworkCapture(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}.`); } // Clear all data arrays but keep capture running captureData.requests = []; captureData.responses = []; captureData.wsFrames = []; captureData.streamingResponses = []; return { sessionId, status: "cleared", message: "Network capture data cleared, capture continues", options: captureData.options, }; }
  • src/index.js:379-393 (registration)
    Registers the clear_network_capture tool in the MCP server's tool list, including its description and input schema.
    { name: "clear_network_capture", description: "Clear all captured network data without stopping the capture session. Resets request/response buffers while keeping capture active. Useful for long-running captures where you want to periodically clear old data to prevent memory issues.", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "Session ID obtained from initialize_session", }, }, required: ["sessionId"], }, },
  • Input schema definition for the clear_network_capture tool, specifying the required sessionId parameter.
    inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "Session ID obtained from initialize_session", }, }, required: ["sessionId"], },
  • Switch case in the MCP CallTool request handler that validates input and invokes the clearNetworkCapture handler.
    case "clear_network_capture": { const { sessionId } = args; if (!sessionId) { throw new McpError( ErrorCode.InvalidParams, "sessionId parameter is required" ); } result = await clearNetworkCapture(sessionId); break; }

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