fastmcp/docs/python-sdk/fastmcp-utilities-components.mdx
2025-06-24 13:02:03 -05:00

52 lines
1.3 KiB
Text

---
title: components
sidebarTitle: components
---
# `fastmcp.utilities.components`
## Classes
### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L21" target="_blank">↗</a></sup>
Base class for FastMCP tools, prompts, resources, and resource templates.
**Methods:**
#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L48" target="_blank">↗</a></sup>
```python
key(self) -> str
```
The key of the component. This is used for internal bookkeeping
and may reflect e.g. prefixes or other identifiers. You should not depend on
keys having a certain value, as the same tool loaded from different
hierarchies of servers may have different keys.
#### `with_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L57" target="_blank">↗</a></sup>
```python
with_key(self, key: str) -> Self
```
#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L69" target="_blank">↗</a></sup>
```python
enable(self) -> None
```
Enable the component.
#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L73" target="_blank">↗</a></sup>
```python
disable(self) -> None
```
Disable the component.