File tree Expand file tree Collapse file tree
grpc/src/main/java/io/a2a/transport/grpc/handler
main/java/io/a2a/transport/jsonrpc/handler
test/java/io/a2a/transport/jsonrpc/handler
rest/src/main/java/io/a2a/transport/rest/handler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -546,6 +546,10 @@ public void onComplete() {
546546 public void getExtendedAgentCard (io .a2a .grpc .GetExtendedAgentCardRequest request ,
547547 StreamObserver <io .a2a .grpc .AgentCard > responseObserver ) {
548548 try {
549+ if (!getAgentCard ().capabilities ().extendedAgentCard ()) {
550+ handleError (responseObserver , new UnsupportedOperationError ());
551+ return ;
552+ }
549553 AgentCard extendedAgentCard = getExtendedAgentCard ();
550554 if (extendedAgentCard != null ) {
551555 responseObserver .onNext (ToProto .agentCard (extendedAgentCard ));
Original file line number Diff line number Diff line change 4747import io .a2a .spec .EventKind ;
4848import io .a2a .spec .InternalError ;
4949import io .a2a .spec .InvalidRequestError ;
50+ import io .a2a .spec .UnsupportedOperationError ;
5051import io .a2a .spec .ListTaskPushNotificationConfigResult ;
5152import io .a2a .spec .PushNotificationNotSupportedError ;
5253import io .a2a .spec .StreamingEventKind ;
@@ -667,7 +668,10 @@ public DeleteTaskPushNotificationConfigResponse deletePushNotificationConfig(
667668 // TODO: Add authentication (https://github.com/a2aproject/a2a-java/issues/77)
668669 public GetExtendedAgentCardResponse onGetExtendedCardRequest (
669670 GetExtendedAgentCardRequest request , ServerCallContext context ) {
670- if (!agentCard .capabilities ().extendedAgentCard () || extendedAgentCard == null || !extendedAgentCard .isResolvable ()) {
671+ if (!agentCard .capabilities ().extendedAgentCard ()) {
672+ return new GetExtendedAgentCardResponse (request .getId (), new UnsupportedOperationError ());
673+ }
674+ if (extendedAgentCard == null || !extendedAgentCard .isResolvable ()) {
671675 return new GetExtendedAgentCardResponse (request .getId (),
672676 new ExtendedAgentCardNotConfiguredError (null , "Extended Card not configured" , null ));
673677 }
Original file line number Diff line number Diff line change @@ -1541,7 +1541,7 @@ public void testOnGetExtendedAgentCard() throws Exception {
15411541 GetExtendedAgentCardRequest request = new GetExtendedAgentCardRequest ("1" );
15421542 GetExtendedAgentCardResponse response = handler .onGetExtendedCardRequest (request , callContext );
15431543 assertEquals (request .getId (), response .getId ());
1544- assertInstanceOf (ExtendedAgentCardNotConfiguredError .class , response .getError ());
1544+ assertInstanceOf (UnsupportedOperationError .class , response .getError ());
15451545 assertNull (response .getResult ());
15461546 }
15471547
Original file line number Diff line number Diff line change @@ -871,7 +871,10 @@ private static String mapErrorToURI(A2AError error) {
871871 */
872872 public HTTPRestResponse getExtendedAgentCard (ServerCallContext context , String tenant ) {
873873 try {
874- if (!agentCard .capabilities ().extendedAgentCard () || extendedAgentCard == null || !extendedAgentCard .isResolvable ()) {
874+ if (!agentCard .capabilities ().extendedAgentCard ()) {
875+ throw new UnsupportedOperationError ();
876+ }
877+ if (extendedAgentCard == null || !extendedAgentCard .isResolvable ()) {
875878 throw new ExtendedAgentCardNotConfiguredError (null , "Extended Card not configured" , null );
876879 }
877880 return new HTTPRestResponse (200 , APPLICATION_JSON , JsonUtil .toJson (extendedAgentCard .get ()));
You can’t perform that action at this time.
0 commit comments