mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 20:14:17 +02:00
chore: Update SDK documentation (#2949)
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
This commit is contained in:
parent
0e4d519c86
commit
8596c09fdf
4 changed files with 140 additions and 24 deletions
|
|
@ -121,7 +121,7 @@ get_tool(self, name: str, version: VersionSpec | None = None) -> Tool | None
|
|||
Get tool by transformed name with all transforms applied.
|
||||
|
||||
Note: This method does NOT filter disabled components. The Server
|
||||
(FastMCP) performs visibility filtering after all transforms complete,
|
||||
(FastMCP) performs enabled filtering after all transforms complete,
|
||||
allowing session-level transforms to override provider-level disables.
|
||||
|
||||
**Args:**
|
||||
|
|
@ -152,7 +152,7 @@ get_resource(self, uri: str, version: VersionSpec | None = None) -> Resource | N
|
|||
Get resource by transformed URI with all transforms applied.
|
||||
|
||||
Note: This method does NOT filter disabled components. The Server
|
||||
(FastMCP) performs visibility filtering after all transforms complete.
|
||||
(FastMCP) performs enabled filtering after all transforms complete.
|
||||
|
||||
**Args:**
|
||||
- `uri`: The transformed resource URI to look up.
|
||||
|
|
@ -182,7 +182,7 @@ get_resource_template(self, uri: str, version: VersionSpec | None = None) -> Res
|
|||
Get resource template by transformed URI with all transforms applied.
|
||||
|
||||
Note: This method does NOT filter disabled components. The Server
|
||||
(FastMCP) performs visibility filtering after all transforms complete.
|
||||
(FastMCP) performs enabled filtering after all transforms complete.
|
||||
|
||||
**Args:**
|
||||
- `uri`: The transformed template URI to look up.
|
||||
|
|
@ -212,7 +212,7 @@ get_prompt(self, name: str, version: VersionSpec | None = None) -> Prompt | None
|
|||
Get prompt by transformed name with all transforms applied.
|
||||
|
||||
Note: This method does NOT filter disabled components. The Server
|
||||
(FastMCP) performs visibility filtering after all transforms complete.
|
||||
(FastMCP) performs enabled filtering after all transforms complete.
|
||||
|
||||
**Args:**
|
||||
- `name`: The transformed prompt name to look up.
|
||||
|
|
@ -261,7 +261,7 @@ enable(self) -> Self
|
|||
|
||||
Enable components matching all specified criteria.
|
||||
|
||||
Adds an enabled transform that marks matching components as enabled.
|
||||
Adds a visibility transform that marks matching components as enabled.
|
||||
Later transforms override earlier ones, so enable after disable makes
|
||||
the component enabled.
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Final filtering happens at the Provider level.
|
|||
|
||||
## Functions
|
||||
|
||||
### `is_enabled` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L269" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `is_enabled` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L271" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
is_enabled(component: FastMCPComponent) -> bool
|
||||
|
|
@ -37,7 +37,7 @@ Returns False if visibility mark is False.
|
|||
- True if component should be enabled/visible to clients.
|
||||
|
||||
|
||||
### `get_visibility_rules` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L298" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `get_visibility_rules` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L300" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_visibility_rules(context: Context) -> list[dict[str, Any]]
|
||||
|
|
@ -47,7 +47,7 @@ get_visibility_rules(context: Context) -> list[dict[str, Any]]
|
|||
Load visibility rule dicts from session state.
|
||||
|
||||
|
||||
### `save_visibility_rules` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L303" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `save_visibility_rules` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L305" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
save_visibility_rules(context: Context, rules: list[dict[str, Any]]) -> None
|
||||
|
|
@ -64,7 +64,7 @@ If None, sends notifications for all types (safe default).
|
|||
If provided, only sends notifications for specified types.
|
||||
|
||||
|
||||
### `create_visibility_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L330" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `create_visibility_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L332" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
create_visibility_transforms(rules: list[dict[str, Any]]) -> list[Visibility]
|
||||
|
|
@ -74,7 +74,7 @@ create_visibility_transforms(rules: list[dict[str, Any]]) -> list[Visibility]
|
|||
Convert rule dicts to Visibility transforms.
|
||||
|
||||
|
||||
### `get_session_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L358" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `get_session_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L360" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_session_transforms(context: Context) -> list[Visibility]
|
||||
|
|
@ -84,7 +84,7 @@ get_session_transforms(context: Context) -> list[Visibility]
|
|||
Get session-specific Visibility transforms from state store.
|
||||
|
||||
|
||||
### `enable_components` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L370" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `enable_components` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L372" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
enable_components(context: Context) -> None
|
||||
|
|
@ -110,7 +110,7 @@ ResourceListChangedNotification, and PromptListChangedNotification.
|
|||
- `match_all`: If True, matches all components regardless of other criteria.
|
||||
|
||||
|
||||
### `disable_components` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L424" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `disable_components` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L426" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
disable_components(context: Context) -> None
|
||||
|
|
@ -136,7 +136,7 @@ ResourceListChangedNotification, and PromptListChangedNotification.
|
|||
- `match_all`: If True, matches all components regardless of other criteria.
|
||||
|
||||
|
||||
### `reset_visibility` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L478" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `reset_visibility` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L480" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
reset_visibility(context: Context) -> None
|
||||
|
|
@ -154,7 +154,7 @@ ResourceListChangedNotification, and PromptListChangedNotification.
|
|||
- `context`: The context for this session.
|
||||
|
||||
|
||||
### `apply_session_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L495" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
### `apply_session_transforms` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L497" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
apply_session_transforms(components: Sequence[ComponentT]) -> Sequence[ComponentT]
|
||||
|
|
@ -188,7 +188,7 @@ Final filtering happens at the Provider level after all transforms run.
|
|||
|
||||
**Methods:**
|
||||
|
||||
#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L194" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L196" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
list_tools(self, tools: Sequence[Tool]) -> Sequence[Tool]
|
||||
|
|
@ -197,7 +197,7 @@ list_tools(self, tools: Sequence[Tool]) -> Sequence[Tool]
|
|||
Mark tools by visibility state.
|
||||
|
||||
|
||||
#### `get_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L198" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `get_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L200" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_tool(self, name: str, call_next: GetToolNext) -> Tool | None
|
||||
|
|
@ -206,7 +206,7 @@ get_tool(self, name: str, call_next: GetToolNext) -> Tool | None
|
|||
Mark tool if found.
|
||||
|
||||
|
||||
#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L211" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L213" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
list_resources(self, resources: Sequence[Resource]) -> Sequence[Resource]
|
||||
|
|
@ -215,7 +215,7 @@ list_resources(self, resources: Sequence[Resource]) -> Sequence[Resource]
|
|||
Mark resources by visibility state.
|
||||
|
||||
|
||||
#### `get_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L215" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `get_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L217" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_resource(self, uri: str, call_next: GetResourceNext) -> Resource | None
|
||||
|
|
@ -224,7 +224,7 @@ get_resource(self, uri: str, call_next: GetResourceNext) -> Resource | None
|
|||
Mark resource if found.
|
||||
|
||||
|
||||
#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L234" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
list_resource_templates(self, templates: Sequence[ResourceTemplate]) -> Sequence[ResourceTemplate]
|
||||
|
|
@ -233,7 +233,7 @@ list_resource_templates(self, templates: Sequence[ResourceTemplate]) -> Sequence
|
|||
Mark resource templates by visibility state.
|
||||
|
||||
|
||||
#### `get_resource_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L238" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `get_resource_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L240" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_resource_template(self, uri: str, call_next: GetResourceTemplateNext) -> ResourceTemplate | None
|
||||
|
|
@ -242,7 +242,7 @@ get_resource_template(self, uri: str, call_next: GetResourceTemplateNext) -> Res
|
|||
Mark resource template if found.
|
||||
|
||||
|
||||
#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L255" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L257" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
list_prompts(self, prompts: Sequence[Prompt]) -> Sequence[Prompt]
|
||||
|
|
@ -251,10 +251,11 @@ list_prompts(self, prompts: Sequence[Prompt]) -> Sequence[Prompt]
|
|||
Mark prompts by visibility state.
|
||||
|
||||
|
||||
#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L259" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/transforms/visibility.py#L261" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_prompt(self, name: str, call_next: GetPromptNext) -> Prompt | None
|
||||
```
|
||||
|
||||
Mark prompt if found.
|
||||
|
||||
|
|
|
|||
114
docs/python-sdk/fastmcp-utilities-skills.mdx
Normal file
114
docs/python-sdk/fastmcp-utilities-skills.mdx
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
---
|
||||
title: skills
|
||||
sidebarTitle: skills
|
||||
---
|
||||
|
||||
# `fastmcp.utilities.skills`
|
||||
|
||||
|
||||
Client utilities for discovering and downloading skills from MCP servers.
|
||||
|
||||
## Functions
|
||||
|
||||
### `list_skills` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L40" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
list_skills(client: Client) -> list[SkillSummary]
|
||||
```
|
||||
|
||||
|
||||
List all available skills from an MCP server.
|
||||
|
||||
Discovers skills by finding resources with URIs matching the
|
||||
`skill://{name}/SKILL.md` pattern.
|
||||
|
||||
**Args:**
|
||||
- `client`: Connected FastMCP client
|
||||
|
||||
**Returns:**
|
||||
- List of SkillSummary objects with name, description, and URI
|
||||
|
||||
|
||||
### `get_skill_manifest` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L84" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
get_skill_manifest(client: Client, skill_name: str) -> SkillManifest
|
||||
```
|
||||
|
||||
|
||||
Get the manifest for a specific skill.
|
||||
|
||||
**Args:**
|
||||
- `client`: Connected FastMCP client
|
||||
- `skill_name`: Name of the skill
|
||||
|
||||
**Returns:**
|
||||
- SkillManifest with file listing
|
||||
|
||||
**Raises:**
|
||||
- `ValueError`: If manifest cannot be read or parsed
|
||||
|
||||
|
||||
### `download_skill` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L124" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
download_skill(client: Client, skill_name: str, target_dir: str | Path) -> Path
|
||||
```
|
||||
|
||||
|
||||
Download a skill and all its files to a local directory.
|
||||
|
||||
Creates a subdirectory named after the skill containing all files.
|
||||
|
||||
**Args:**
|
||||
- `client`: Connected FastMCP client
|
||||
- `skill_name`: Name of the skill to download
|
||||
- `target_dir`: Directory where skill folder will be created
|
||||
- `overwrite`: If True, overwrite existing skill directory. If False
|
||||
(default), raise FileExistsError if directory exists.
|
||||
|
||||
**Returns:**
|
||||
- Path to the downloaded skill directory
|
||||
|
||||
**Raises:**
|
||||
- `ValueError`: If skill cannot be found or downloaded
|
||||
- `FileExistsError`: If skill directory exists and overwrite=False
|
||||
|
||||
|
||||
### `sync_skills` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L214" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
```python
|
||||
sync_skills(client: Client, target_dir: str | Path) -> list[Path]
|
||||
```
|
||||
|
||||
|
||||
Download all available skills from a server.
|
||||
|
||||
**Args:**
|
||||
- `client`: Connected FastMCP client
|
||||
- `target_dir`: Directory where skill folders will be created
|
||||
- `overwrite`: If True, overwrite existing files
|
||||
|
||||
**Returns:**
|
||||
- List of paths to downloaded skill directories
|
||||
|
||||
|
||||
## Classes
|
||||
|
||||
### `SkillSummary` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
|
||||
Summary information about a skill available on a server.
|
||||
|
||||
|
||||
### `SkillFile` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L24" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
|
||||
Information about a file within a skill.
|
||||
|
||||
|
||||
### `SkillManifest` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/skills.py#L33" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
||||
|
||||
|
||||
Full manifest of a skill including all files.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue