Skip to content

fix(tools): stop partial tools colliding and send the __call__ docstring - #7191

Open
Om-singhaI wants to merge 1 commit into
google:mainfrom
Om-singhaI:fix/function-tool-partial-and-callable-declarations
Open

Om-singhaI wants to merge 1 commit into
google:mainfrom
Om-singhaI:fix/function-tool-partial-and-callable-declarations

Conversation

@Om-singhaI

@Om-singhaI Om-singhaI commented Sep 18, 2026

Copy link
Copy Markdown

Fixes #7190

Link to Issue or Description of Change

Solution: get_callable_name and a new get_callable_doc unwrap partials. The JSON schema declaration now uses get_callable_doc, like CallableSpec, so it also sends inherited method docstrings.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

5 new tests fail on main. I didn't run the full suite. 12 related test_*.py files gave 393 passed: callable_utils, llm_request, function_node, node_tool, function_tool* (4 files), build_function_declaration, from_function_with_options, long_running_tool and authenticated_function_tool.

Manual E2E Tests: no live model run. The issue repro now prints the right names and docstrings.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have reviewed my own code.
  • I have commented my code, particularly in hard to understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end to end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Follow ups: args bound by keyword still land in the schema, and the legacy builder still reads func.__doc__.

FunctionTool declared every functools.partial as `partial` with the
docstring of functools.partial itself, so two partial tools were
registered under the same name and only the last one could be called.
The name now comes from the wrapped callable, and so does the docstring
unless the partial carries its own.

A callable object documented only on `__call__` reported that docstring
as `tool.description` but sent no description in its declaration,
because the JSON schema builder read `func.__doc__` directly. The lookup
CallableSpec already did now lives in `get_callable_doc`, and the
declaration uses it too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants