get_network_activity
Retrieve captured network requests and responses to analyze web traffic during debugging sessions, with options to filter by request type and clear history.
Instructions
Recupera todas as requisições de rede capturadas
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clear | No | Limpar histórico após recuperação | |
| filterType | No | Filtrar por tipo | all |
Implementation Reference
- src/browserTools.ts:297-323 (handler)The handler function that executes the get_network_activity tool logic: casts args to GetNetworkActivityArgs, filters networkRequests from browserState by type if specified, optionally clears the requests, and returns a JSON-formatted result with count and requests list.export async function handleGetNetworkActivity(args: unknown): Promise<ToolResponse> { const typedArgs = args as unknown as GetNetworkActivityArgs; const { filterType = 'all', clear = false } = typedArgs; let activity = browserState.networkRequests; if (filterType !== 'all') { activity = activity.filter((req) => req.type === filterType); } const result = { count: activity.length, requests: activity, }; if (clear) { clearNetworkRequests(); } return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/types.ts:60-63 (schema)TypeScript interface defining the input arguments for the get_network_activity tool: optional filterType (all/request/response) and clear boolean.export interface GetNetworkActivityArgs { filterType?: 'all' | 'request' | 'response'; clear?: boolean; }
- src/tools.ts:126-145 (registration)The tool registration object in the tools array, including name, description, and inputSchema matching the MCP tool specification.{ name: 'get_network_activity', description: 'Recupera todas as requisições de rede capturadas', inputSchema: { type: 'object', properties: { filterType: { type: 'string', enum: ['all', 'request', 'response'], description: 'Filtrar por tipo', default: 'all', }, clear: { type: 'boolean', description: 'Limpar histórico após recuperação', default: false, }, }, }, },
- src/index.ts:89-90 (registration)Dispatch case in the main tool handler switch statement that routes calls to get_network_activity to the handleGetNetworkActivity function.case 'get_network_activity': return await handleGetNetworkActivity(args);
- src/index.ts:15-15 (registration)Import of the handleGetNetworkActivity handler function from browserTools.js in the main index file.handleGetNetworkActivity,