mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-20 04:24:17 +02:00
89 lines
2.9 KiB
Text
89 lines
2.9 KiB
Text
---
|
|
title: prompt_manager
|
|
sidebarTitle: prompt_manager
|
|
---
|
|
|
|
# `fastmcp.prompts.prompt_manager`
|
|
|
|
## Classes
|
|
|
|
### `PromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Manages FastMCP prompts.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
mount(self, server: MountedServer) -> None
|
|
```
|
|
|
|
Adds a mounted server as a source for prompts.
|
|
|
|
|
|
#### `has_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
has_prompt(self, key: str) -> bool
|
|
```
|
|
|
|
Check if a prompt exists.
|
|
|
|
|
|
#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L96" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_prompt(self, key: str) -> Prompt
|
|
```
|
|
|
|
Get prompt by key.
|
|
|
|
|
|
#### `get_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L103" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
get_prompts(self) -> dict[str, Prompt]
|
|
```
|
|
|
|
Gets the complete, unfiltered inventory of all prompts.
|
|
|
|
|
|
#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
list_prompts(self) -> list[Prompt]
|
|
```
|
|
|
|
Lists all prompts, applying protocol filtering.
|
|
|
|
|
|
#### `add_prompt_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L116" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
add_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None) -> FunctionPrompt
|
|
```
|
|
|
|
Create a prompt from a function.
|
|
|
|
|
|
#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
add_prompt(self, prompt: Prompt) -> Prompt
|
|
```
|
|
|
|
Add a prompt to the manager.
|
|
|
|
|
|
#### `render_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L154" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
render_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> GetPromptResult
|
|
```
|
|
|
|
Internal API for servers: Finds and renders a prompt, respecting the
|
|
filtered protocol path.
|
|
|