Skip to content

FunctionTool declares every functools.partial as partial and drops the __call__ docstring #7190

Description

@Om-singhaI

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.

Repro on main (f33d492), Python 3.13:

from functools import partial
from google.adk.models.llm_request import LlmRequest
from google.adk.tools.function_tool import FunctionTool

def get_weather(key: str, city: str):
  """Current weather for a city."""

def get_forecast(key: str, city: str):
  """Forecast for a city."""

class OrderLookup:
  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())])
for d in req.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.

Activity

  1. aslamalkarywk7 commented on Sep 18, 2026

    @aslamalkarywk7

    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!

  2. aslamalkarywk7 commented on Sep 19, 2026

    @aslamalkarywk7

    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.

  3. Om-singhaI commented on Sep 20, 2026

    @Om-singhaI
    ContributorAuthor

    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.

  4. aslamalkarywk7 commented on Sep 20, 2026

    @aslamalkarywk7

    @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.

  5. surajksharma07 commented on Sep 21, 2026

    @surajksharma07
    Collaborator

    @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.

  6. added a commit that references this issue on Oct 9, 2026
    6a60d6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

tools[Component] This issue is related to tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions