mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 23:29:10 +02:00
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
121 lines
3.9 KiB
Text
121 lines
3.9 KiB
Text
---
|
|
title: components
|
|
sidebarTitle: components
|
|
---
|
|
|
|
# `fastmcp.utilities.components`
|
|
|
|
## Classes
|
|
|
|
### `FastMCPMeta` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L16" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></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#L66" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></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.
|
|
|
|
|
|
#### `get_meta` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L75" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_meta(self, include_fastmcp_meta: bool | None = None) -> dict[str, Any] | None
|
|
```
|
|
|
|
Get the meta information about the component.
|
|
|
|
If include_fastmcp_meta is True, a `_fastmcp` key will be added to the
|
|
meta, containing a `tags` field with the tags of the component.
|
|
|
|
|
|
#### `model_copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
model_copy(self) -> Self
|
|
```
|
|
|
|
Create a copy of the component.
|
|
|
|
**Args:**
|
|
- `update`: A dictionary of fields to update.
|
|
- `deep`: Whether to deep copy the component.
|
|
- `key`: The key to use for the copy.
|
|
|
|
|
|
#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L132" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></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#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
disable(self) -> None
|
|
```
|
|
|
|
Disable the component.
|
|
|
|
|
|
#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
copy(self) -> Self
|
|
```
|
|
|
|
Create a copy of the component.
|
|
|
|
|
|
### `MirroredComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L145" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Base class for components that are mirrored from a remote server.
|
|
|
|
Mirrored components cannot be enabled or disabled directly. Call copy() first
|
|
to create a local version you can modify.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L158" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></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#L167" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
disable(self) -> None
|
|
```
|
|
|
|
Disable the component.
|
|
|
|
|
|
#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L176" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
copy(self) -> Self
|
|
```
|
|
|
|
Create a copy of the component that can be modified.
|
|
|