MCPcopy
hub / github.com/google/adk-python / _remap_ids_in_args

Function _remap_ids_in_args

src/google/adk/cli/agent_test_runner.py:431–446  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

429
430
431def _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(

Callers 1

_normalize_idsFunction · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected