Skip to content

Commit fd71115

Browse files
committed
fix function disable_tool and enable_tool. Pytest executed successfully
1 parent 1e4f570 commit fd71115

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,17 @@ async def fetch_weather(city: str) -> str:
247247
return response.text
248248

249249

250-
# Get a reference to the tool
251250
tool = mcp._tool_manager.get_tool("fetch_weather")
252251

253252

254-
# Disable the tool temporarily
255-
await tool.disable(mcp.get_context())
253+
async def disable_tool():
254+
# Disable the tool temporarily
255+
await tool.disable(mcp.get_context())
256256

257257

258-
# Later, re-enable the tool
259-
await tool.enable(mcp.get_context())
258+
async def enable_tool():
259+
# Re-enable the tool when needed
260+
await tool.enable(mcp.get_context())
260261
```
261262

262263
### Prompts

0 commit comments

Comments
 (0)