mirror of
https://github.com/jmagar/unraid-mcp.git
synced 2026-03-23 12:39:24 -07:00
fix: add confirm guard for update_ssh, fix avatar dropped without username/email
- info.py: add DESTRUCTIVE_ACTIONS set with update_ssh, add confirm param to unraid_info signature, add destructive guard before mutation handlers - settings.py: build user_info dict unconditionally so avatar is included even when username/email are absent; only attach userInfo when non-empty Resolves review threads PRRT_kwDOO6Hdxs50FgO0 PRRT_kwDOO6Hdxs50FgPC
This commit is contained in:
@@ -171,6 +171,7 @@ MUTATIONS: dict[str, str] = {
|
||||
""",
|
||||
}
|
||||
|
||||
DESTRUCTIVE_ACTIONS = {"update_ssh"}
|
||||
ALL_ACTIONS = set(QUERIES) | set(MUTATIONS)
|
||||
|
||||
INFO_ACTIONS = Literal[
|
||||
@@ -326,6 +327,7 @@ def register_info_tool(mcp: FastMCP) -> None:
|
||||
@mcp.tool()
|
||||
async def unraid_info(
|
||||
action: INFO_ACTIONS,
|
||||
confirm: bool = False,
|
||||
device_id: str | None = None,
|
||||
server_name: str | None = None,
|
||||
server_comment: str | None = None,
|
||||
@@ -361,6 +363,9 @@ def register_info_tool(mcp: FastMCP) -> None:
|
||||
if action not in ALL_ACTIONS:
|
||||
raise ToolError(f"Invalid action '{action}'. Must be one of: {sorted(ALL_ACTIONS)}")
|
||||
|
||||
if action in DESTRUCTIVE_ACTIONS and not confirm:
|
||||
raise ToolError(f"Action '{action}' is destructive. Set confirm=True to proceed.")
|
||||
|
||||
if action == "ups_device" and not device_id:
|
||||
raise ToolError("device_id is required for ups_device action")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user