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

Method set_risk_threshold

src/mcp_cli/utils/preferences.py:459–471  ·  view source on GitHub ↗

Set whether to confirm tools at a specific risk level. Args: risk_level: 'safe', 'moderate', or 'high' should_confirm: Whether to confirm tools at this risk level

(self, risk_level: str, should_confirm: bool)

Source from the content-addressed store, hash-verified

457 return False
458
459 def set_risk_threshold(self, risk_level: str, should_confirm: bool) -> None:
460 """Set whether to confirm tools at a specific risk level.
461
462 Args:
463 risk_level: 'safe', 'moderate', or 'high'
464 should_confirm: Whether to confirm tools at this risk level
465 """
466 try:
467 level = ToolRiskLevel(risk_level)
468 except ValueError:
469 raise ValueError(f"Invalid risk level: {risk_level}")
470 self.preferences.ui.tool_confirmation.risk_thresholds[level] = should_confirm
471 self.save_preferences()
472
473 def get_active_provider(self) -> str | None:
474 """Get active provider."""

Callers 1

test_risk_thresholdsMethod · 0.95

Calls 2

save_preferencesMethod · 0.95
ToolRiskLevelClass · 0.85

Tested by 1

test_risk_thresholdsMethod · 0.76