Skip to content

[BUG] Pydantic schema generation error for PIL.Image.Image in toolkit integration #2861

@coolbeevip

Description

@coolbeevip

Required prerequisites

What version of camel are you using?

0.2.71a10

System information

>>> import sys, camel
>>> print(sys.version, sys.platform)
3.11.8 (main, Jan 14 2025, 13:47:38) [Clang 15.0.0 (clang-1500.3.9.4)] darwin
>>> print(camel.__version__)
0.2.71a10

Problem description

When using VideoAnalysisToolkit together with VideoDownloaderToolkit and MCPServer integration, a runtime error occurs during tool registration. The stack trace shows that Pydantic fails to generate a schema for PIL.Image.Image return types (e.g., get_video_screenshots), resulting in a PydanticSchemaGenerationError. This is triggered because MCPServer attempts to parse and wrap functions with output annotations involving PIL.Image.Image, which is not natively supported by Pydantic schema generation.

The error is reproducible when MCPServer decorates toolkits that expose methods returning PIL.Image.Image or its list variants.

Reproducible example code

related camel-ai/owl#563

Traceback

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Task with high level prioritybugSomething isn't workingcall for contribution

    Type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions