Skip to content

Commit cea2683

Browse files
refactor(agent-tools): pass bare caxton tools
googleapis/python-genai#3060 is fixed in google-genai 2.31.0, which no longer adds "type": "object" to optional scalar parameters in callable tool schemas. Pass Caxton's tool functions as bare callables again instead of wrapping them in FunctionDeclaration, and require google-genai>=2.31.0 in Caxton and Popper (which also passes bare callables with optional scalar parameters). Keep coerce_tool_args as a runtime guard against malformed arguments.
1 parent 03f25a3 commit cea2683

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

‎skills/agent-tools/scripts/caxton‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# /// script
33
# requires-python = ">=3.11"
44
# dependencies = [
5-
# "google-genai",
5+
# "google-genai>=2.31.0",
66
# "httpx",
77
# ]
88
# [tool.uv.sources]
@@ -2538,23 +2538,6 @@ def main():
25382538

25392539
tool_map = {fn.__name__: fn for fn in tools}
25402540

2541-
# Declare the functions explicitly. Handed bare callables, google-genai
2542-
# builds a JSON schema that types each optional argument (`int | None`)
2543-
# as both anyOf[integer, null] and "object", and Gemini then fills those
2544-
# arguments with an empty object instead of a number or nothing. Once
2545-
# https://github.com/googleapis/python-genai/issues/3060 is fixed in a
2546-
# release, bare callables would work again; coerce_tool_args stays either
2547-
# way, as a guard against malformed arguments.
2548-
tools = [
2549-
types.Tool(
2550-
function_declarations=[
2551-
types.FunctionDeclaration.from_callable_with_api_option(
2552-
callable=fn, api_option="GEMINI_API"
2553-
)
2554-
for fn in tools
2555-
]
2556-
)
2557-
]
25582541
if args.search:
25592542
tools.append({"google_search": {}})
25602543
if args.code:

‎skills/agent-tools/scripts/popper‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# requires-python = ">=3.11"
55
# dependencies = [
66
# "uiautomator2",
7-
# "google-genai",
7+
# "google-genai>=2.31.0",
88
# "google-api-core",
99
# "pillow",
1010
# # apkutils is an optional dependency of uiautomator2, needed for installing

0 commit comments

Comments
 (0)