Class NetworkCaptureOptions

java.lang.Object
com.shaft.capture.runtime.NetworkCaptureOptions

public class NetworkCaptureOptions extends Object
Options for network capture filtering and behavior in SHAFT Capture. Used by MCP API capture tools to control what network transactions are recorded.

Kept as a plain mutable class with public fields (rather than a record) because Spring AI binds @Tool method parameters of this type directly from tool-call JSON; equals(Object) and hashCode() are still overridden for structural equality since instances round-trip through CaptureStartOptions, a record whose generated equals depends on it.

Do not switch the field annotations below to @ToolParam(required = false). That is the usual Spring AI idiom (see CaptureService#apiStart parameters and McpMobileInitOptions), but this class lives in shaft-capture -- a low-level runtime module that shaft-mcp depends on, not the reverse -- and @ToolParam lives in spring-ai-model, which shaft-capture deliberately does not depend on. Pulling that in here would invert the module boundary just to annotate a DTO. Instead this relies on Spring AI's JSON schema generator (victools' JacksonModule with RESPECT_JSONPROPERTY_REQUIRED) honouring the framework-neutral com.fasterxml.jackson.annotation.JsonProperty(required = ...) as an equivalent signal -- confirmed by decompiling spring-ai-model's JsonSchemaGenerator. ShaftMcpApplicationTests#captureApiStartNetworkOptionsSchemaHasNoRequiredFieldsSoPartialNetworkOptionsSucceed guards this behavior against regression (issue #3986).

  • Field Details

    • enabled

      public boolean enabled
      Whether to capture network requests.
    • excludeAssets

      public boolean excludeAssets
      Whether to exclude asset resource types (images, fonts, stylesheets).
    • excludePattern

      public String excludePattern
      Glob pattern for URL paths to exclude from capture.
    • includePattern

      public String includePattern
      Glob pattern for URL paths to include in capture. Empty string means include all (subject to other filters).
    • captureResponseBodies

      public boolean captureResponseBodies
      Whether to record HTTP response bodies.
    • captureRequestBodies

      public boolean captureRequestBodies
      Whether to record HTTP request bodies.
  • Constructor Details

    • NetworkCaptureOptions

      public NetworkCaptureOptions()
      Creates default network capture options.
  • Method Details