Description
Is your feature request related to a problem? Please describe.
Currently function tools can only have primitive / simple types. It'd be useful to support Enums, even other complex types, though this issue will focus on Enums.
Describe the solution you'd like
Support for Enum arguments in function tool calls
Describe alternatives you've considered
In the case of Enums, we've considered using literals instead, but find that the Agent can make values up rather than using values in the literal. A workaround is to make the function parameter of string type, and put the valid options into the functions docstring. However, that's tedious for large enums.
Additional context
as an example, calling the following function tool:
from enum import Enum
class CountryCodeEnum(Enum):
UNITED_STATES = "US"
CANADA = "CA"
...
def get_weather(city: str, country: CountyCodeEnum):
...would throw the following error:
Failed to parse the parameter country of function get_weather for
automatic function calling. Automatic function calling works best with
simpler function signature schema,consider manually parse your
function declaration for function get_weather.
That's because _parse_schema_from_parameter in src/google/adk/tools/function_parameter_parse_util.py does not currently support Enum type args.
Activity
kavinkumar807 commentedon Apr 26, 2025
@paullpp can you please give me more context?
thomasglow commentedon May 3, 2025
Example error:
juszzz commentedon Sep 15, 2025
@lucasnobre212 opened a PR to resolve this issue back in May and it seems like its still waiting on a review. Is there anyone with merge permissions who can take a look at it? There are a lot of auto-generated client libraries that make liberal use of enums and it would be nice to drop those library methods in as tools to our agents.
dennisgera commentedon Sep 18, 2025
I'm also running into this issue. Would love to have functions accept an enum as a parameter. Just looked at @juszzz's PR, LGTM. Does anyone know when we can have that merged? Is anyone allowed to approve adk PRs?
docs(guides): add type annotation best practices guide for function t…
jpantsjoha commentedon Oct 18, 2025
I've submitted a documentation PR with Enum workarounds while we wait for native support:
PR: google/adk-docs#786
The type annotation guide documents using
typing.Literalas an interim solution:Benefits:
This should help developers until native Enum support is implemented (tracked in this issue and #2733).
Jacksunwei commentedon Oct 28, 2025
Thanks @jpantsjoha for documenting the
typing.Literalworkaround in the ADK docs PR.This issue is a duplicate of #3089, which is already being tracked in the 10/27 ADK Week milestone.
Please continue the discussion in #3089 to keep everything in one place and help maintainers track progress more easily.