Skip to content

Commit ddbe414

Browse files
committed
Ensure all property types are translated when converting function calls to a2a
Python and Go implementations of ADK both copy function call and response properties by copying the entire struct automatically. Java does this a property at a time and so was missing the "id" property of the ADK event. Providing these allows downstream agents to properly associate multiple tool calls and responses to the same tool name.
1 parent bed8a4a commit ddbe414

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

a2a/src/main/java/com/google/adk/a2a/converters/PartConverter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ private static Optional<com.google.genai.types.Part> convertDataPartToGenAiPart(
169169
private static Optional<DataPart> createDataPartFromFunctionCall(FunctionCall functionCall) {
170170
Map<String, Object> data = new HashMap<>();
171171
data.put("name", functionCall.name().orElse(""));
172+
data.put("id", functionCall.id().orElse(""));
172173
data.put("args", functionCall.args().orElse(Map.of()));
173174

174175
Map<String, Object> metadata =
@@ -187,6 +188,7 @@ private static Optional<DataPart> createDataPartFromFunctionResponse(
187188
FunctionResponse functionResponse) {
188189
Map<String, Object> data = new HashMap<>();
189190
data.put("name", functionResponse.name().orElse(""));
191+
data.put("id", functionResponse.id().orElse(""));
190192
data.put("response", functionResponse.response().orElse(Map.of()));
191193

192194
Map<String, Object> metadata =

0 commit comments

Comments
 (0)