Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions spec/src/main/java/io/a2a/spec/MessageSendParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
*/
public record MessageSendParams(Message message, @Nullable MessageSendConfiguration configuration,
@Nullable Map<String, Object> metadata, String tenant) {
@Nullable Map<String, Object> 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);
Comment thread
CokeLee777 marked this conversation as resolved.
Resolved
Assert.checkNotNullParam("tenant", tenant);
tenant = tenant == null ? "" : tenant;
}
Comment thread
CokeLee777 marked this conversation as resolved.
Resolved

/**
* 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
Expand All @@ -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();
Expand Down Expand Up @@ -112,10 +108,10 @@ public Builder metadata(@Nullable Map<String, Object> 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;
}
Expand All @@ -131,7 +127,7 @@ public MessageSendParams build() {
Assert.checkNotNullParam("message", message),
configuration,
metadata,
tenant == null ? "" : tenant);
tenant);
}
}
}
Loading