Skip to content

Feature: support Pydantic Model as function param and return type #1066

Closed

Description

@Jacksunwei

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Is your feature request related to a problem? Please describe.

When defining function tool using python function, we need to allow simple pyndatic model as params and return types.

E.g.

class Param1(BaseModel); 
  id: str
  query: str

class Param2(BaseModel); 
  id: str
  log: str

class ReturnType(BaseModel):
  result: str

def my_tool(param_1: Param1, param_2: Param2) -> ReturnType:
  ... 

Describe the solution you'd like

  • Supporting to convert PydanticModel to json schema then to FunctionDeclaration for the usage of GenAI SDK.

Describe alternatives you've considered

N/A

Additional context

N/A

Activity

  1. self-assigned this
    on May 30, 2025
  2. added
    tools[Component] This issue is related to tools
    on May 30, 2025
  3. hangfei commented on May 30, 2025

    @hangfei
    Collaborator

    @Jacksunwei is driving this work.

    If you have any requirements or thoughts, please share with him. Thanks!

  4. added this to the Feature Roadmap milestone on May 30, 2025
  5. mikeedjones commented on Sep 3, 2025

    @mikeedjones
    Contributor

    Ideally it would work with complex pydantic models! It would also be good to be able to mark some of the arguments as to be excluded from the LM-generation like FastMCP's exclude_args.

  6. self-assigned this
    on Oct 10, 2025
  7. added
    models[Component] This issue is related to model support
    on Oct 15, 2025
  8. added
    request clarification[Status] The maintainer need clarification or more information from the author
    needs review[Status] The PR/issue is awaiting review from the maintainer
    and removed
    request clarification[Status] The maintainer need clarification or more information from the author
    on Nov 18, 2025
  9. lucasnobre212 commented on Feb 13, 2026

    @lucasnobre212
    Contributor

    @Jacksunwei Any updates on this?

  10. armude commented on Apr 20, 2026

    @armude

    Are you going to add this anytime soon?

  11. xuanyang15 commented on Jun 26, 2026

    @xuanyang15
    Collaborator

    This has been supported with the feature JSON_SCHEMA_FOR_FUNC_DECL being enabled by default.

  12. self-assigned this
    on Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

models[Component] This issue is related to model supportneeds review[Status] The PR/issue is awaiting review from the maintainertools[Component] This issue is related to tools

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions