From 9fc85ea48c74f3c53aa9dd43077307f537ac3e11 Mon Sep 17 00:00:00 2001 From: Jacob Magar Date: Sat, 14 Mar 2026 14:13:52 -0400 Subject: [PATCH] refactor(creds): remove per-tool elicitation from unraid_storage --- unraid_mcp/tools/storage.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/unraid_mcp/tools/storage.py b/unraid_mcp/tools/storage.py index dfccc7d..610396a 100644 --- a/unraid_mcp/tools/storage.py +++ b/unraid_mcp/tools/storage.py @@ -7,24 +7,14 @@ unassigned devices, log files, and log content retrieval. import os from typing import Any, Literal, get_args -from fastmcp import Context as _Context from fastmcp import FastMCP from ..config.logging import logger from ..core.client import DISK_TIMEOUT, make_graphql_request -from ..core.exceptions import CredentialsNotConfiguredError as _CredErr from ..core.exceptions import ToolError, tool_error_handler -from ..core.setup import elicit_and_configure as _elicit from ..core.utils import format_bytes -# Re-export at module scope so tests can patch "unraid_mcp.tools.storage.elicit_and_configure" -# and "unraid_mcp.tools.storage.CredentialsNotConfiguredError" -elicit_and_configure = _elicit -CredentialsNotConfiguredError = _CredErr -Context = _Context - - _ALLOWED_LOG_PREFIXES = ("/var/log/", "/boot/logs/", "/mnt/") _MAX_TAIL_LINES = 10_000 @@ -112,7 +102,6 @@ def register_storage_tool(mcp: FastMCP) -> None: source_path: str | None = None, destination_path: str | None = None, backup_options: dict[str, Any] | None = None, - ctx: Context | None = None, ) -> dict[str, Any]: """Manage Unraid storage, disks, and logs. @@ -188,15 +177,7 @@ def register_storage_tool(mcp: FastMCP) -> None: with tool_error_handler("storage", action, logger): logger.info(f"Executing unraid_storage action={action}") - try: - data = await make_graphql_request(query, variables, custom_timeout=custom_timeout) - except CredentialsNotConfiguredError: - configured = await elicit_and_configure(ctx) - if not configured: - raise ToolError( - "Credentials required. Run `unraid_health action=setup` to configure." - ) - data = await make_graphql_request(query, variables, custom_timeout=custom_timeout) + data = await make_graphql_request(query, variables, custom_timeout=custom_timeout) if action == "shares": return {"shares": data.get("shares", [])}