Skip to content

Commit 8b4f17c

Browse files
committed
update dependencies and enhance documentation for A2A agent; improve README and FAQ sections
1 parent 88a5886 commit 8b4f17c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/java/io/github/vishalmysore/a2a/domain/Task.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import io.github.vishalmysore.common.CommonClientRequest;
77
import io.github.vishalmysore.common.CommonClientResponse;
88
import lombok.Data;
9+
import lombok.Getter;
10+
import lombok.Setter;
911
import lombok.ToString;
1012

1113
import java.util.ArrayList;
@@ -28,7 +30,8 @@
2830
* All implementation of Task can be done in applications extending this library
2931
*/
3032
@Data
31-
33+
@Getter
34+
@Setter
3235
@ToString
3336
public class Task implements A2ATask, CommonClientRequest, CommonClientResponse {
3437

src/main/java/io/github/vishalmysore/common/CommonClientResponse.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.vishalmysore.common;
22

33
import io.github.vishalmysore.a2a.domain.SendTaskResponse;
4+
import io.github.vishalmysore.a2a.domain.Task;
45
import io.github.vishalmysore.a2a.domain.TextPart;
56
import io.github.vishalmysore.mcp.domain.CallToolResult;
67
import io.github.vishalmysore.mcp.domain.TextContent;
@@ -37,6 +38,19 @@ default String getTextResult() {
3738
}
3839
}
3940

41+
return "";
42+
} else if (this instanceof Task) {
43+
Task task = (Task) this;
44+
var status = task.getStatus();
45+
if (status != null && status.getMessage() != null) {
46+
var parts = status.getMessage().getParts();
47+
if (parts != null && !parts.isEmpty()) {
48+
Object lastPart = parts.get(parts.size() - 1);
49+
if (lastPart instanceof TextPart) {
50+
return ((TextPart) lastPart).getText();
51+
}
52+
}
53+
}
4054
return "";
4155
} else {
4256
throw new IllegalStateException("Unexpected response type: " + this.getClass());

0 commit comments

Comments
 (0)