fix: add logs to ALL_ACTIONS so ToolError guidance is reachable

logs was absent from ALL_ACTIONS (it has no GraphQL query since the
docker.logs field was removed in Unraid 7.2.x), so the early validation
guard rejected action="logs" before reaching the helpful ToolError that
explains the web UI / SSH alternative.

Also add inline comments to dict_actions explaining that network, connect,
and variables all share the vars root field — each query requests its own
subfields so there is no overlap.

Resolves review thread 2832300880 (cubic-dev-ai)
Resolves review thread 2832300152 (coderabbitai)
This commit is contained in:
Jacob Magar 2026-04-03 23:13:28 -04:00
parent 8f388158b7
commit 0bb9ce7096
2 changed files with 10 additions and 4 deletions

View file

@ -105,7 +105,9 @@ _ACTIONS_REQUIRING_CONTAINER_ID = {
"details",
"logs",
}
ALL_ACTIONS = set(QUERIES) | set(MUTATIONS) | {"restart"}
# "logs" has no GraphQL query (field removed in Unraid 7.2.x) but is still a
# valid action — it reaches the ToolError handler that explains the alternative.
ALL_ACTIONS = set(QUERIES) | set(MUTATIONS) | {"restart", "logs"}
DOCKER_ACTIONS = Literal[
"list",

View file

@ -356,11 +356,15 @@ def register_info_tool(mcp: FastMCP) -> None:
# Lookup tables for common response patterns
# Simple dict actions: action -> GraphQL response key
# Note: "network", "connect", and "variables" all query the `vars` root
# field (Unraid 7.2.x merged these endpoints into a single vars object).
# GraphQL returns only the subfields requested per query, so the shared
# root causes no overlap — each action still fetches its own field set.
dict_actions: dict[str, str] = {
"network": "vars",
"network": "vars", # GetNetworkConfig — useSsl, port, portssl, localTld
"registration": "registration",
"connect": "vars",
"variables": "vars",
"connect": "vars", # GetConnectSettings — flashGuid, flashProduct, flashVendor
"variables": "vars", # GetSelectiveUnraidVariables — full vars payload
"metrics": "metrics",
"config": "config",
"owner": "owner",