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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions