diff --git a/spec/src/main/java/io/a2a/spec/MessageSendParams.java b/spec/src/main/java/io/a2a/spec/MessageSendParams.java index e1c75a668..00aa6a7cb 100644 --- a/spec/src/main/java/io/a2a/spec/MessageSendParams.java +++ b/spec/src/main/java/io/a2a/spec/MessageSendParams.java @@ -17,29 +17,25 @@ * @param message the message to send to the agent (required) * @param configuration optional configuration for message processing behavior * @param metadata optional arbitrary key-value metadata for the request - * @param tenant optional tenant, provided as a path parameter. + * @param tenant optional tenant identifier provided as a path parameter; defaults to empty string if not specified * @see MessageSendConfiguration for available configuration options * @see A2A Protocol Specification */ public record MessageSendParams(Message message, @Nullable MessageSendConfiguration configuration, - @Nullable Map metadata, String tenant) { + @Nullable Map metadata, @Nullable String tenant) { /** - * Compact constructor for validation. - * Validates that required parameters are not null. - * - * @param message the message to send - * @param configuration optional message send configuration - * @param metadata optional metadata - * @param tenant the tenant identifier + * Compact constructor for validation and normalization. + * Validates that {@code message} is not null and normalizes + * {@code tenant} to an empty string if null. */ public MessageSendParams { Assert.checkNotNullParam("message", message); - Assert.checkNotNullParam("tenant", tenant); + tenant = tenant == null ? "" : tenant; } /** - * Convenience constructor with default tenant. + * Convenience constructor that sets tenant to empty string by default. * * @param message the message to send (required) * @param configuration optional configuration for message processing @@ -50,9 +46,9 @@ public MessageSendParams(Message message, @Nullable MessageSendConfiguration con } /** - * Create a new Builder + * Creates a new {@link Builder} for constructing {@link MessageSendParams}. * - * @return the builder + * @return a new builder instance */ public static Builder builder() { return new Builder(); @@ -112,10 +108,10 @@ public Builder metadata(@Nullable Map metadata) { /** * Sets optional tenant for the request. * - * @param tenant arbitrary key-value metadata + * @param tenant optional tenant identifier * @return this builder */ - public Builder tenant(String tenant) { + public Builder tenant(@Nullable String tenant) { this.tenant = tenant; return this; } @@ -131,7 +127,7 @@ public MessageSendParams build() { Assert.checkNotNullParam("message", message), configuration, metadata, - tenant == null ? "" : tenant); + tenant); } } }