Class McpCompleteCompletion.Builder

java.lang.Object
com.github.thought2code.mcp.annotated.server.component.McpCompleteCompletion.Builder
Enclosing class:
McpCompleteCompletion

public static class McpCompleteCompletion.Builder extends Object
Builder class for constructing McpCompleteCompletion instances.

This builder provides a fluent API for creating completion results with defensive copying to protect against external modification of mutable inputs. The builder maintains the same immutability guarantees as the record itself.

Author:
codeboyzhou
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • values

      public McpCompleteCompletion.Builder values(List<String> values)
      Sets the completion values with defensive copying.

      This method creates an immutable copy of the input list to prevent external modification after the value has been set. If the input list is null, the internal values field is set to null.

      Parameters:
      values - the list of completion values to set, may be null
      Returns:
      this McpCompleteCompletion.Builder instance for method chaining
    • total

      public McpCompleteCompletion.Builder total(Integer total)
      Sets the total number of available completions.

      This value represents the total count of completions that could be returned, which may be greater than the number of values in the current completion result if pagination is supported.

      Parameters:
      total - the total number of available completions, may be null
      Returns:
      this McpCompleteCompletion.Builder instance for method chaining
    • hasMore

      public McpCompleteCompletion.Builder hasMore(boolean hasMore)
      Sets whether more completions are available.

      This flag indicates whether additional completion results can be obtained through further requests, typically used for pagination or incremental loading scenarios.

      Parameters:
      hasMore - true if more completions are available, false otherwise
      Returns:
      this McpCompleteCompletion.Builder instance for method chaining
    • build

      public McpCompleteCompletion build()
      Builds a new McpCompleteCompletion instance with the configured values.

      This method creates a new record instance using the current builder state. The record's compact constructor will apply additional defensive copying to ensure the final object is fully immutable.

      Returns:
      a new McpCompleteCompletion instance with the configured values