Repository navigation
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A tool wrapped in
functools.partial, or implemented as a callable instance, loses context injection when its context annotation is a string and the parameter is namedctx. For example:On main, the default JSON schema builder tries to expose
ctxand raisesPydanticSchemaGenerationError; callingrun_asyncdirectly reports it as a missing argument. The context should be injected by ADK and omitted from the model's schema.Solution
Keep
typing.get_type_hintsas the first path, then use the existing callable-aware resolver when it fails or returns no hints. Python 3.14 returns an empty dictionary for these callable forms instead of raisingTypeError. This preserves wrappers with their own annotations or__wrapped__metadata, and keeps parameter selection on the actual callable signature.Testing plan
update_wrapperinstances. Before the fix, the first three cases failed. All five now pass.Runnerwith a scripted model through tool declaration, function call, response and session state: sync partial, async partial and callable instance each returnedfound: hello; their declarations contained onlyquery.uv buildpassed. Formatting, lint, compliance and docs hooks passed. The new-file check was run directly with Python because its/bin/bashshebang is unavailable on Windows; there are no new production files.The legacy declaration builder with
JSON_SCHEMA_FOR_FUNC_DECL=Falsestill has its existing limitations for these callable forms; this change does not alter that builder.