MCPcopy Create free account
hub / github.com/IBM/mcp-cli / set_tool_confirmation_mode

Method set_tool_confirmation_mode

src/mcp_cli/utils/preferences.py:270–282  ·  view source on GitHub ↗

Set the global tool confirmation mode. Args: mode: One of 'always', 'never', or 'smart'

(self, mode: str)

Source from the content-addressed store, hash-verified

268 return self.preferences.ui.tool_confirmation.mode
269
270 def set_tool_confirmation_mode(self, mode: str) -> None:
271 """Set the global tool confirmation mode.
272
273 Args:
274 mode: One of 'always', 'never', or 'smart'
275 """
276 try:
277 confirmation_mode = ConfirmationMode(mode)
278 except ValueError:
279 raise ValueError(f"Invalid confirmation mode: {mode}")
280 self.preferences.ui.tool_confirmation.mode = confirmation_mode
281 self.preferences.ui.confirm_tools = confirmation_mode != ConfirmationMode.NEVER
282 self.save_preferences()
283
284 def get_tool_confirmation(self, tool_name: str) -> str | None:
285 """Get confirmation setting for a specific tool.

Callers 7

main_callbackFunction · 0.80
_chat_commandFunction · 0.80
_interactive_commandFunction · 0.80
executeMethod · 0.80

Calls 2

save_preferencesMethod · 0.95
ConfirmationModeClass · 0.85