Spaces:
Running
Running
| --- | |
| 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#L89" 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#L94" 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#L101" 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#L107" 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#L114" 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#L134" 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#L152" 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. | |