Skip to content

Commit 0ce239e

Browse files
authored
fix: return updated agent_card in JsonRpcTransport.get_card() (#552)
## Fixes #551 ### Changes - Fixed `JsonRpcTransport.get_card()` to return the newly fetched authenticated extended card instead of the stale card ### Details Changed line from `return card` to `return self.agent_card` to ensure the method returns the updated card after fetching the authenticated extended version. This aligns the JsonRpcTransport behavior with RestTransport's correct implementation. ### Testing - Verified the fix matches RestTransport's pattern - Confirmed internal state and return value are now consistent Release-As: 0.3.18
1 parent 7e121e0 commit 0ce239e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/a2a/client/transports/jsonrpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async def get_card(
414414
raise A2AClientJSONRPCError(response.root)
415415
self.agent_card = response.root.result
416416
self._needs_extended_card = False
417-
return card
417+
return self.agent_card
418418

419419
async def close(self) -> None:
420420
"""Closes the httpx client."""

tests/client/transports/test_jsonrpc_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ async def test_get_card_with_extended_card_support(
774774
mock_send_request.return_value = rpc_response
775775
card = await client.get_card()
776776

777-
assert card == agent_card
777+
assert card == AGENT_CARD_EXTENDED
778778
mock_send_request.assert_called_once()
779779
sent_payload = mock_send_request.call_args.args[0]
780780
assert sent_payload['method'] == 'agent/getAuthenticatedExtendedCard'

0 commit comments

Comments
 (0)