Skip to content

fix(schemas): give optional tool params a None default#36

Open
devteamaegis wants to merge 1 commit into
agentmail-to:mainfrom
devteamaegis:fix/optional-schema-defaults
Open

fix(schemas): give optional tool params a None default#36
devteamaegis wants to merge 1 commit into
agentmail-to:mainfrom
devteamaegis:fix/optional-schema-defaults

Conversation

@devteamaegis

@devteamaegis devteamaegis commented Jun 9, 2026

Copy link
Copy Markdown

What's broken

Every optional field in the toolkit's parameter schemas is declared as Optional[...] = Field(description=...) with no default. In Pydantic v2 an Optional field without a default is still required, so the tools mark fields the API treats as optional as mandatory. Calling create_inbox with no arguments — the documented way to get a random inbox — raises before any request is made:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for CreateInboxParams
username  Field required [type=missing, ...]
domain    Field required [type=missing, ...]
display_name  Field required [type=missing, ...]

The same defect breaks minimal calls to list/send/reply/forward/update.

Why it happens

In Pydantic v2, Optional[X] = Field(...) without default= is a required field.

Fix

Add default=None to the optional fields that were missing it.

Test

CreateInboxParams() and ListItemsParams(limit=5) now construct without error; both raised ValidationError before.


Summary by cubic

Set default=None on all optional params in the toolkit schemas to match pydantic v2 behavior. This prevents ValidationError crashes on minimal calls like create_inbox() with no args.

  • Bug Fixes
    • Set default=None for all Optional fields across parameter models so optional inputs are truly optional.
    • Added tests confirming CreateInboxParams() and ListItemsParams(limit=5) instantiate without errors and keep page_token=None.

Written for commit 715ae78. Summary will update on new commits.

Review in cubic

…ls don't crash

Optional[...] fields declared with Field(description=...) and no default are
required in Pydantic v2, so invoking tools like create_inbox with no arguments
(the documented default) raised a ValidationError instead of running.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@devteamaegis devteamaegis force-pushed the fix/optional-schema-defaults branch from b9aea45 to 715ae78 Compare June 11, 2026 19:44
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.

1 participant