interceptor_chrome_devtools_get_network_field
Retrieve specific header field values from captured network traffic in Chrome DevTools sessions for analysis and debugging purposes.
Instructions
Get one full header field value from proxy-captured traffic by field_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| devtools_session_id | Yes | Session ID from interceptor_chrome_devtools_attach | |
| field_id | Yes | field_id from interceptor_chrome_devtools_list_network_fields | |
| value_max_chars | No | Max characters for returned value (default: 20000) |
Implementation Reference
- src/tools/devtools.ts:1283-1352 (handler)The handler implementation for the tool 'interceptor_chrome_devtools_get_network_field' which retrieves a full header field value from proxy-captured traffic.
"interceptor_chrome_devtools_get_network_field", "Get one full header field value from proxy-captured traffic by field_id.", { devtools_session_id: z.string().describe("Session ID from interceptor_chrome_devtools_attach"), field_id: z.string().describe("field_id from interceptor_chrome_devtools_list_network_fields"), value_max_chars: z.number().optional().default(HARD_VALUE_CAP_CHARS) .describe(`Max characters for returned value (default: ${HARD_VALUE_CAP_CHARS})`), }, async ({ devtools_session_id, field_id, value_max_chars }) => { try { const session = devToolsBridge.getSession(devtools_session_id); if (!session) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `DevTools session '${devtools_session_id}' not found.` }) }] }; } const { targetId } = await ensureSessionTargetIsAlive(devtools_session_id); const parts = field_id.split("."); if (parts.length !== 4 || parts[0] !== "nf") { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Invalid field_id '${field_id}'` }) }] }; } const exchangeId = parts[1]; const dir = parts[2]; const headerName = fromBase64UrlUtf8(parts[3]); const exchange = proxyManager.getExchange(exchangeId); if (!exchange) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Exchange '${exchangeId}' not found in capture buffer.` }) }] }; } if (exchange.timestamp < session.createdAt) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: "field_id refers to an exchange older than this DevTools session." }) }] }; } let value: string | null = null; if (dir === "request") { value = exchange.request.headers[headerName.toLowerCase()] ?? null; } else if (dir === "response") { value = exchange.response?.headers?.[headerName.toLowerCase()] ?? null; } else { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Invalid field direction '${dir}'` }) }] }; } if (value === null) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Header '${headerName}' not found on ${dir}.` }) }] }; } const capped = capValue(value, Math.max(0, Math.min(HARD_VALUE_CAP_CHARS, Math.trunc(value_max_chars ?? HARD_VALUE_CAP_CHARS)))); return { content: [{ type: "text", text: truncateResult({ status: "success", devtools_session_id, target_id: targetId, field_id, exchange_id: exchangeId, direction: dir, header_name: headerName, value: capped.value, value_length: capped.valueLength, value_truncated: capped.truncated, value_max_chars: capped.maxChars, }), }], }; } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] }; } }, ); - src/tools/devtools.ts:1283-1353 (registration)Registration of the 'interceptor_chrome_devtools_get_network_field' tool within the MCP server.
"interceptor_chrome_devtools_get_network_field", "Get one full header field value from proxy-captured traffic by field_id.", { devtools_session_id: z.string().describe("Session ID from interceptor_chrome_devtools_attach"), field_id: z.string().describe("field_id from interceptor_chrome_devtools_list_network_fields"), value_max_chars: z.number().optional().default(HARD_VALUE_CAP_CHARS) .describe(`Max characters for returned value (default: ${HARD_VALUE_CAP_CHARS})`), }, async ({ devtools_session_id, field_id, value_max_chars }) => { try { const session = devToolsBridge.getSession(devtools_session_id); if (!session) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `DevTools session '${devtools_session_id}' not found.` }) }] }; } const { targetId } = await ensureSessionTargetIsAlive(devtools_session_id); const parts = field_id.split("."); if (parts.length !== 4 || parts[0] !== "nf") { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Invalid field_id '${field_id}'` }) }] }; } const exchangeId = parts[1]; const dir = parts[2]; const headerName = fromBase64UrlUtf8(parts[3]); const exchange = proxyManager.getExchange(exchangeId); if (!exchange) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Exchange '${exchangeId}' not found in capture buffer.` }) }] }; } if (exchange.timestamp < session.createdAt) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: "field_id refers to an exchange older than this DevTools session." }) }] }; } let value: string | null = null; if (dir === "request") { value = exchange.request.headers[headerName.toLowerCase()] ?? null; } else if (dir === "response") { value = exchange.response?.headers?.[headerName.toLowerCase()] ?? null; } else { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Invalid field direction '${dir}'` }) }] }; } if (value === null) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Header '${headerName}' not found on ${dir}.` }) }] }; } const capped = capValue(value, Math.max(0, Math.min(HARD_VALUE_CAP_CHARS, Math.trunc(value_max_chars ?? HARD_VALUE_CAP_CHARS)))); return { content: [{ type: "text", text: truncateResult({ status: "success", devtools_session_id, target_id: targetId, field_id, exchange_id: exchangeId, direction: dir, header_name: headerName, value: capped.value, value_length: capped.valueLength, value_truncated: capped.truncated, value_max_chars: capped.maxChars, }), }], }; } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] }; } }, ); }