File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
src/main/java/io/github/vishalmysore Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 66import io .github .vishalmysore .common .CommonClientRequest ;
77import io .github .vishalmysore .common .CommonClientResponse ;
88import lombok .Data ;
9+ import lombok .Getter ;
10+ import lombok .Setter ;
911import lombok .ToString ;
1012
1113import java .util .ArrayList ;
2830 * All implementation of Task can be done in applications extending this library
2931 */
3032@ Data
31-
33+ @ Getter
34+ @ Setter
3235@ ToString
3336public class Task implements A2ATask , CommonClientRequest , CommonClientResponse {
3437
Original file line number Diff line number Diff line change 11package io .github .vishalmysore .common ;
22
33import io .github .vishalmysore .a2a .domain .SendTaskResponse ;
4+ import io .github .vishalmysore .a2a .domain .Task ;
45import io .github .vishalmysore .a2a .domain .TextPart ;
56import io .github .vishalmysore .mcp .domain .CallToolResult ;
67import 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 ());
You can’t perform that action at this time.
0 commit comments