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

Method set_tool_confirmation

src/mcp_cli/utils/preferences.py:295–308  ·  view source on GitHub ↗

Set confirmation for a specific tool. Args: tool_name: Name of the tool setting: 'always', 'never', 'ask', or None (remove override)

(self, tool_name: str, setting: str | None)

Source from the content-addressed store, hash-verified

293 return self.preferences.ui.tool_confirmation.per_tool.get(tool_name)
294
295 def set_tool_confirmation(self, tool_name: str, setting: str | None) -> None:
296 """Set confirmation for a specific tool.
297
298 Args:
299 tool_name: Name of the tool
300 setting: 'always', 'never', 'ask', or None (remove override)
301 """
302 if setting is None:
303 self.preferences.ui.tool_confirmation.per_tool.pop(tool_name, None)
304 else:
305 if setting not in ["always", "never", "ask"]:
306 raise ValueError(f"Invalid tool confirmation setting: {setting}")
307 self.preferences.ui.tool_confirmation.per_tool[tool_name] = setting
308 self.save_preferences()
309
310 def get_all_tool_confirmations(self) -> dict[str, str]:
311 """Get all per-tool confirmation settings."""

Calls 1

save_preferencesMethod · 0.95

Tested by 3