diff --git a/src/fastmcp/utilities/components.py b/src/fastmcp/utilities/components.py index 715084a8b..f2955c6b0 100644 --- a/src/fastmcp/utilities/components.py +++ b/src/fastmcp/utilities/components.py @@ -63,7 +63,7 @@ class FastMCPComponent(FastMCPBaseModel): def get_meta(self) -> dict[str, Any]: """Get the meta information about the component.""" if self.tags: - return {"tags": list(self.tags)} | self.meta + return {"tags": sorted(self.tags)} | self.meta else: return self.meta diff --git a/tests/server/openapi/test_basic_functionality.py b/tests/server/openapi/test_basic_functionality.py index 29e67360f..014531b87 100644 --- a/tests/server/openapi/test_basic_functionality.py +++ b/tests/server/openapi/test_basic_functionality.py @@ -97,7 +97,7 @@ class TestTools: assert tools[0].model_dump() == dict( name="create_user_users_post", - meta={"tags": ["users", "create"]}, + meta=dict(tags=["create", "users"]), title=None, annotations=None, description=IsStr(regex=r"^Create a new user\..*$", regex_flags=re.DOTALL), @@ -122,7 +122,7 @@ class TestTools: ) assert tools[1].model_dump() == dict( name="update_user_name_users", - meta={"tags": ["users", "update"]}, + meta=dict(tags=["update", "users"]), title=None, annotations=None, description=IsStr(