Skip to content

Inconsistent Field Naming Between outputSchema and model_dump #1073

Closed
@akolotov

Description

@akolotov

If the model to return by a tool is defined like:

class Foo(BaseModel):
    field_first: str | None = Field(
        default=None, alias="first", description="The first field."
    )
    field_second: str | None = Field(
        default=None, alias="second", description="The second field."
    )

In outputSchema of tools/list they will be displayed as "first" and "second".

At the same time model_dump in

structured_content = validated.model_dump(mode="json")

will produce the dump with "field_first" and "field_second".

To keep the schema and the tool response consistent, consider adding by_alias=True to the call of model_dump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions