You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FunctionTool declares every functools.partial as partial and drops the __call__ docstring #7190
If you bind an API key into two tools with functools.partial, they're both declared as partial with the functools.partial docstring. Only the last one stays registered, so weather calls run get_forecast.
A callable object documented only on __call__ shows that docstring in tool.description, but its declaration doesn't have one.
fromfunctoolsimportpartialfromgoogle.adk.models.llm_requestimportLlmRequestfromgoogle.adk.tools.function_toolimportFunctionTooldefget_weather(key: str, city: str):
"""Current weather for a city."""defget_forecast(key: str, city: str):
"""Forecast for a city."""classOrderLookup:
def__call__(self, order_id: str):
"""Finds an order by id."""req=LlmRequest()
req.append_tools([FunctionTool(partial(get_weather, "k")),
FunctionTool(partial(get_forecast, "k")),
FunctionTool(OrderLookup())])
fordinreq.config.tools[0].function_declarations:
print(d.name, repr(d.description))
It logs Duplicate tool name 'partial', prints partial twice, then OrderLookup None. I'd expect each tool under its own name and docstring.
Hi! I would like to work on this issue. My planned approach: in FunctionTool name/description inference, unwrap functools.partial (use partial.func.name and its docstring) and for callable instances fall back to type(obj).name plus the call docstring, with regression tests using the repro from this issue (no model or network needed). Please let me know if that direction sounds right, and assign it to me if so. Google CLA is already signed on my account. Thanks!
Opened PR #7198 with the fix (partial unwrapping for names, unwrap-aware description with instance call fallback, 6 new tests, full declarations suite 51/51 green). Google CLA is signed on my account. Happy to adjust if you prefer a different approach.
Heads up @aslamalkarywk7, #7191 has been open for this since I filed the issue, so there are two PRs closing it now. I'll leave it to the maintainers to pick one.
@Om-singhaI Thanks for the heads-up — I really appreciate it. I’m glad to see this is being looked at, and I’d be happy to collaborate on the fix if that helps. I’m already working through the issue and would welcome the opportunity to coordinate with you so we can avoid duplicated effort and land a solid solution together. Thanks again for the note and for keeping everyone informed.
@Om-singhaI Reproduced this on main (2.9.0). Partials never get unwrapped when the tool name and description are picked so both end up as "partial".
As a workaround try setting p.name and p.doc on each partial (or wrapping it in a small named function) and see if each tool then shows up under its own name and docstring on your end. Please test it thoroughly and confirm it works before raising or updating a PR, and worth checking that a keyword-bound arg like key="k" still lands in the schema as a default.
Since #7191 and #7198 both target this the maintainers will probably want to pick one so it may help to coordinate there.
Activity
aslamalkarywk7 commentedon Sep 18, 2026
Hi! I would like to work on this issue. My planned approach: in FunctionTool name/description inference, unwrap functools.partial (use partial.func.name and its docstring) and for callable instances fall back to type(obj).name plus the call docstring, with regression tests using the repro from this issue (no model or network needed). Please let me know if that direction sounds right, and assign it to me if so. Google CLA is already signed on my account. Thanks!
aslamalkarywk7 commentedon Sep 19, 2026
Opened PR #7198 with the fix (partial unwrapping for names, unwrap-aware description with instance call fallback, 6 new tests, full declarations suite 51/51 green). Google CLA is signed on my account. Happy to adjust if you prefer a different approach.
Om-singhaI commentedon Sep 20, 2026
Heads up @aslamalkarywk7, #7191 has been open for this since I filed the issue, so there are two PRs closing it now. I'll leave it to the maintainers to pick one.
aslamalkarywk7 commentedon Sep 20, 2026
@Om-singhaI Thanks for the heads-up — I really appreciate it. I’m glad to see this is being looked at, and I’d be happy to collaborate on the fix if that helps. I’m already working through the issue and would welcome the opportunity to coordinate with you so we can avoid duplicated effort and land a solid solution together. Thanks again for the note and for keeping everyone informed.
surajksharma07 commentedon Sep 21, 2026
@Om-singhaI Reproduced this on main (2.9.0). Partials never get unwrapped when the tool name and description are picked so both end up as "partial".
As a workaround try setting p.name and p.doc on each partial (or wrapping it in a small named function) and see if each tool then shows up under its own name and docstring on your end. Please test it thoroughly and confirm it works before raising or updating a PR, and worth checking that a keyword-bound arg like key="k" still lands in the schema as a default.
Since #7191 and #7198 both target this the maintainers will probably want to pick one so it may help to coordinate there.
fix: stop partial tools colliding and send the __call__ docstring