Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/mcp/server/fastmcp/utilities/func_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ def model_dump_one_level(self) -> dict[str, Any]:
)


class OutputModelBase(BaseModel):
"""A model representing the output of a function."""

model_config = ConfigDict(
arbitrary_types_allowed=True,
)


class FuncMetadata(BaseModel):
arg_model: Annotated[type[ArgModelBase], WithJsonSchema(None)]
output_schema: dict[str, Any] | None = None
Expand Down Expand Up @@ -433,7 +441,7 @@ def _create_wrapped_model(func_name: str, annotation: Any, field_info: FieldInfo
if annotation is None:
annotation = type(None)

return create_model(model_name, result=(annotation, field_info), __base__=BaseModel)
return create_model(model_name, result=(annotation, field_info), __base__=OutputModelBase)


def _create_dict_model(func_name: str, dict_annotation: Any) -> type[BaseModel]:
Expand Down
Loading