Skip to main content
Glama

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
NameRequiredDescriptionDefault
devtools_session_idYesSession ID from interceptor_chrome_devtools_attach
field_idYesfield_id from interceptor_chrome_devtools_list_network_fields
value_max_charsNoMax characters for returned value (default: 20000)

Implementation Reference

  • 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) }) }] };
        }
      },
    );
  • 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) }) }] };
          }
        },
      );
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/yfe404/proxy-mcp'

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