From 79ffb3e8bc2b0d44bcda865183439cab84789738 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Tue, 13 May 2025 18:47:21 -0400 Subject: [PATCH] Add documentation for tool removal --- docs/servers/tools.mdx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/servers/tools.mdx b/docs/servers/tools.mdx index 26468e7f2..3a850d9cc 100644 --- a/docs/servers/tools.mdx +++ b/docs/servers/tools.mdx @@ -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 + + + +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