Add enabled property to components

This commit is contained in:
Jeremiah Lowin 2025-06-10 10:21:06 -04:00
commit 244501a6a6

View file

@ -32,6 +32,11 @@ class FastMCPComponent(FastMCPBaseModel):
description="Tags for the component.",
)
enabled: bool = Field(
default=True,
description="Whether the component is enabled.",
)
def __eq__(self, other: object) -> bool:
if type(self) is not type(other):
return False
@ -40,3 +45,11 @@ class FastMCPComponent(FastMCPBaseModel):
def __repr__(self) -> str:
return f"{self.__class__.__name__}(name={self.name!r}, description={self.description!r}, tags={self.tags})"
def enable(self) -> None:
"""Enable the component."""
self.enabled = True
def disable(self) -> None:
"""Disable the component."""
self.enabled = False