Skip to content

Commit 086cc54

Browse files
committed
add enable and disable tool functionality to README
1 parent 04207c4 commit 086cc54

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
- [Prompts](#prompts)
3131
- [Images](#images)
3232
- [Context](#context)
33+
- [Authentication](#authentication)
3334
- [Running Your Server](#running-your-server)
3435
- [Development Mode](#development-mode)
3536
- [Claude Desktop Integration](#claude-desktop-integration)
3637
- [Direct Execution](#direct-execution)
38+
- [Streamable HTTP Transport](#streamable-http-transport)
3739
- [Mounting to an Existing ASGI Server](#mounting-to-an-existing-asgi-server)
3840
- [Examples](#examples)
3941
- [Echo Server](#echo-server)
@@ -243,6 +245,15 @@ async def fetch_weather(city: str) -> str:
243245
async with httpx.AsyncClient() as client:
244246
response = await client.get(f"https://api.weather.com/{city}")
245247
return response.text
248+
249+
# Get a reference to the tool
250+
tool = mcp._tool_manager.get_tool("fetch_weather")
251+
252+
# Disable the tool temporarily
253+
await tool.disable(mcp.get_context())
254+
255+
# Later, re-enable the tool
256+
await tool.enable(mcp.get_context())
246257
```
247258

248259
### Prompts

0 commit comments

Comments
 (0)