{"record":{"id":"e24a38fca2287bd0","repo":"PrefectHQ/fastmcp","slug":"component-disable-was-removed-in-fastmcp-3-0-us","errorCode":null,"errorMessage":"Component.disable() was removed in FastMCP 3.0. Use server.disable(keys=['{self.key}']) instead.","messagePattern":"Component\\.disable\\(\\) was removed in FastMCP 3\\.0\\. Use server\\.disable\\(keys=\\['(.+?)'\\]\\) instead\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/utilities/components.py","lineNumber":218,"sourceCode":"        parts.extend(\n            [\n                f\"title={self.title!r}\",\n                f\"description={self.description!r}\",\n                f\"tags={self.tags}\",\n            ]\n        )\n        return f\"{self.__class__.__name__}({', '.join(parts)})\"\n\n    def enable(self) -> None:\n        \"\"\"Removed in 3.0. Use server.enable(keys=[...]) instead.\"\"\"\n        raise NotImplementedError(\n            f\"Component.enable() was removed in FastMCP 3.0. \"\n            f\"Use server.enable(keys=['{self.key}']) instead.\"\n        )\n\n    def disable(self) -> None:\n        \"\"\"Removed in 3.0. Use server.disable(keys=[...]) instead.\"\"\"\n        raise NotImplementedError(\n            f\"Component.disable() was removed in FastMCP 3.0. \"\n            f\"Use server.disable(keys=['{self.key}']) instead.\"\n        )\n\n    def copy(self) -> Self:  # type: ignore[override]  # ty:ignore[invalid-method-override]\n        \"\"\"Create a copy of the component.\"\"\"\n        return self.model_copy()\n\n    def get_span_attributes(self) -> dict[str, Any]:\n        \"\"\"Return span attributes for telemetry.\n\n        Subclasses should call super() and merge their specific attributes.\n        \"\"\"\n        return {\"fastmcp.component.key\": self.key}\n","sourceCodeStart":200,"sourceCodeEnd":233,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/utilities/components.py#L200-L233","documentation":"The counterpart of enable(): `Component.disable()` was removed in FastMCP 3.0 and raises NotImplementedError directing users to `server.disable(keys=['<component key>'])`. Disable state is managed by the server, not by mutating components in place.","triggerScenarios":"Calling `component.disable()` on any FastMCPComponent (tool, resource, template, prompt) under FastMCP 3.x.","commonSituations":"2.x-era runtime feature-flag code disabling tools conditionally; copied examples using per-component disable.","solutions":["Replace with `server.disable(keys=[component.key])`.","Manage enabled/disabled state through the server API keyed by component.key.","Audit code for `.disable()` calls after upgrading to 3.0."],"exampleFix":"// before\ntool.disable()\n// after\nmcp.disable(keys=[tool.key])","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    tool.disable()\nexcept NotImplementedError:\n    mcp.disable(keys=[tool.key])","preventionTips":["Manage component state only through the server API in 3.x","Audit 2.x-era feature-flag code paths during migration","Store the component.key when creating components to use with server APIs"],"tags":["fastmcp","api-removal","migration","version-3"],"backgroundTag":"api-removed-in-major-version","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}