Interface CompletionResult

All Superinterfaces:
HasMeta

@Immutable public interface CompletionResult extends HasMeta
Completion candidates for a single argument, per the MCP completion/complete result shape. The spec caps a response at 100 values; the dispatcher truncates and forces hasMore=true if a function returns more.
  • Method Details

    • values

      List<String> values()
      Candidate values ranked by relevance.
    • total

      @Nullable Long total()
      The total number of matches, if known.
    • hasMore

      @Nullable Boolean hasMore()
      Whether additional results exist beyond values().
    • meta

      @Nullable Map<String,Object> meta()
      Optional protocol extension metadata.
      Specified by:
      meta in interface HasMeta
      Returns:
      the metadata map, or null if none
    • empty

      static CompletionResult empty()
      An empty completion result with no candidates, unknown total, and no more results.
    • of

      static CompletionResult of(List<String> values)
      Creates a result with candidate values and no total/hasMore metadata.
    • of

      static CompletionResult of(List<String> values, @Nullable Long total, @Nullable Boolean hasMore)
      Creates a result with candidate values and total/hasMore metadata.
    • builder

      static CompletionResult.Builder builder()
      Creates a new builder for CompletionResult.