Walk a FC ``args`` value and remap any ``id`` field that names an FC. Tool-confirmation FCs (``adk_request_confirmation``) carry the original FC as ``args.originalFunctionCall``; its ``id`` needs to be remapped to the canonical ``fc-N`` value just like the top-level FC id.
(value: Any, id_map: dict[str, str])
| 429 | |
| 430 | |
| 431 | def _remap_ids_in_args(value: Any, id_map: dict[str, str]) -> None: |
| 432 | """Walk a FC ``args`` value and remap any ``id`` field that names an FC. |
| 433 | |
| 434 | Tool-confirmation FCs (``adk_request_confirmation``) carry the |
| 435 | original FC as ``args.originalFunctionCall``; its ``id`` needs to be |
| 436 | remapped to the canonical ``fc-N`` value just like the top-level FC id. |
| 437 | """ |
| 438 | if isinstance(value, dict): |
| 439 | for k, v in list(value.items()): |
| 440 | if k == "id" and isinstance(v, str) and v in id_map: |
| 441 | value[k] = id_map[v] |
| 442 | else: |
| 443 | _remap_ids_in_args(v, id_map) |
| 444 | elif isinstance(value, list): |
| 445 | for item in value: |
| 446 | _remap_ids_in_args(item, id_map) |
| 447 | |
| 448 | |
| 449 | @pytest.mark.parametrize( |