mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 05:54:19 +02:00
Add documentation for tool removal
This commit is contained in:
parent
08d54ef65b
commit
79ffb3e8bc
1 changed files with 19 additions and 0 deletions
|
|
@ -712,6 +712,25 @@ The duplicate behavior options are:
|
|||
- `"replace"`: Silently replaces the existing tool with the new one.
|
||||
- `"ignore"`: Keeps the original tool and ignores the new registration attempt.
|
||||
|
||||
### Removing Tools
|
||||
|
||||
<VersionBadge version="2.3.4" />
|
||||
|
||||
You can dynamically remove tools from a server using the `remove_tool` method:
|
||||
|
||||
```python
|
||||
from fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP(name="DynamicToolServer")
|
||||
|
||||
@mcp.tool()
|
||||
def calculate_sum(a: int, b: int) -> int:
|
||||
"""Add two numbers together."""
|
||||
return a + b
|
||||
|
||||
mcp.remove_tool("calculate_sum")
|
||||
```
|
||||
|
||||
### Legacy JSON Parsing
|
||||
|
||||
<VersionBadge version="2.2.10" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue