get_network_request_detail
Retrieve detailed information about a specific network request, including headers and optional response body, using the request ID from network logs.
Instructions
Get detailed information about a specific network request, including headers and optionally the response body
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | The request ID from get_network_logs | |
| includeBody | No | Include response body (default: false) | |
| tabId | No | Target tab ID (defaults to active tab) | |
| apiKey | No | API key for authentication |
Implementation Reference
- src/tools/devtools-network.ts:33-54 (registration)The tool 'get_network_request_detail' is registered via server.tool() with its schema (requestId, includeBody, tabId, apiKey) and handler that sends the command via the WebSocket bridge.
server.tool( 'get_network_request_detail', 'Get detailed information about a specific network request, including headers and optionally the response body', { requestId: z.string().describe('The request ID from get_network_logs'), includeBody: z.boolean().optional().describe('Include response body (default: false)'), tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'), apiKey: z.string().optional().describe('API key for authentication'), }, async ({ requestId, includeBody, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'get_network_request_detail', params: { requestId, includeBody }, tabId, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } ); - src/tools/devtools-network.ts:36-41 (schema)Input schema definition for the tool: requestId (required string), includeBody (optional boolean), tabId (optional number), apiKey (optional string).
{ requestId: z.string().describe('The request ID from get_network_logs'), includeBody: z.boolean().optional().describe('Include response body (default: false)'), tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'), apiKey: z.string().optional().describe('API key for authentication'), }, - src/tools/devtools-network.ts:42-53 (handler)The handler function that executes the tool logic: sends a bridge command with command='get_network_request_detail' and params {requestId, includeBody}, then returns the result as JSON text.
async ({ requestId, includeBody, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'get_network_request_detail', params: { requestId, includeBody }, tabId, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } - src/tools/index.ts:14-14 (registration)Import of registerDevtoolsNetworkTools from devtools-network.ts, called at line 41 to register all devtools network tools including get_network_request_detail.
import { registerDevtoolsNetworkTools } from './devtools-network.js'; - src/websocket-bridge.ts:63-103 (helper)The WebSocketBridge.sendCommand() method used by the handler to forward the command to the Chrome extension via WebSocket.
async sendCommand(cmd: BridgeCommand): Promise<BridgeResponse> { if (!this.isConnected()) { return { success: false, error: { code: 'NOT_CONNECTED', message: 'Chrome extension is not connected. Ensure the extension is installed, enabled, and the browser is running.', }, }; } const id = crypto.randomUUID(); const timeout = cmd.timeout ?? DEFAULT_TIMEOUT; return new Promise<BridgeResponse>((resolve, reject) => { const timer = setTimeout(() => { this.pending.delete(id); resolve({ success: false, error: { code: 'TIMEOUT', message: `Command '${cmd.command}' timed out after ${timeout}ms`, }, }); }, timeout); this.pending.set(id, { resolve, reject, timer }); const message = { id, type: 'request', command: cmd.command, params: cmd.params, tabId: cmd.tabId, apiKey: cmd.apiKey, timestamp: Date.now(), }; this.client!.send(JSON.stringify(message)); }); }