Skip to content

The agent that grows with you

fix(a2a): expose schemas through tool describe

Gillecefeed4ca888
diff --git a/plugins/platforms/a2a/tools.py b/plugins/platforms/a2a/tools.py
index 7d48c3173b1..c599ee92a14 100644
--- a/plugins/platforms/a2a/tools.py
+++ b/plugins/platforms/a2a/tools.py
@@ -585,11 +585,12 @@ _HANDLERS = {
def register_tools(ctx) -> None:
"""Register the client tools in the ``a2a`` toolset."""
for name, schema in _SCHEMAS.items():
+ function_schema = schema["function"]
ctx.register_tool(
name=name,
toolset="a2a",
- schema=schema,
+ schema=function_schema,
handler=_HANDLERS[name],
- description=schema["function"]["description"],
+ description=function_schema["description"],
emoji="\U0001f9e9", # puzzle piece
)
diff --git a/tests/plugins/test_a2a_schema_registration.py b/tests/plugins/test_a2a_schema_registration.py
new file mode 100644
index 00000000000..c1614c2451a
--- /dev/null
+++ b/tests/plugins/test_a2a_schema_registration.py
@@ -0,0 +1,46 @@
+"""Regression tests for A2A client-tool schema registration."""
+
+from __future__ import annotations
+
+import json
+
+from plugins.platforms.a2a import tools as a2a_tools
+from tools import tool_search
+from tools.registry import ToolRegistry
+
+
+def test_a2a_call_schema_round_trips_through_tool_describe(monkeypatch):
+ registry = ToolRegistry()
+
+ class _Context:
+ def register_tool(self, name, toolset, schema, handler, **kwargs):
+ registry.register(
+ name=name,
+ toolset=toolset,
+ schema=schema,
+ handler=handler,
+ **kwargs,
+ )
+
+ a2a_tools.register_tools(_Context())
+ definitions = registry.get_definitions({"a2a_call"})
+ monkeypatch.setattr(
+ tool_search,
+ "is_deferrable_tool_name",
+ lambda name: name == "a2a_call",
+ )
+
+ described = json.loads(
+ tool_search.dispatch_tool_describe(
+ {"name": "a2a_call"},
+ current_tool_defs=definitions,
+ )
+ )
+
+ assert described["description"]
+ assert described["parameters"]["required"] == ["agent", "message"]
+ assert set(described["parameters"]["properties"]) == {
+ "agent",
+ "message",
+ "context_id",
+ }