fix: v0.4.1 — remove pause_container / unpause_container (DSM unsupported)
Live test on this DSM firmware: SYNO.Docker.Container has no pause/
unpause method ("Method does not exist"). The Container Manager GUI
action menu only exposes Start / Stop / Force-Stop / Restart / Reset —
pause/resume simply isn't a feature here.
The two tools were briefly shipped in 0.4.0 (implemented by symmetry
with the verified stop call) and have now been removed rather than
left as a broken surface. The remaining lifecycle tools
(start_container, stop_container, restart_container) are unaffected.
Tool count: 33 → 31. Closes #7 (won't fix — DSM limitation).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -390,44 +390,6 @@ def register_containers(mcp: FastMCP, config: AppConfig, client: DsmClient) -> N
|
||||
except Exception as e:
|
||||
return f"Error restarting container '{container_name}': {e}"
|
||||
|
||||
@mcp.tool()
|
||||
async def pause_container(container_name: str, confirmed: bool = False):
|
||||
"""Pause a running container. Requires confirmed=True."""
|
||||
if not confirmed:
|
||||
return (
|
||||
f"Preview: would pause container '{container_name}'.\n"
|
||||
f"Call this tool again with confirmed=True to proceed."
|
||||
)
|
||||
|
||||
resolved_name = await _resolve_container_name(client, container_name)
|
||||
display_name = _strip_hash_prefix(resolved_name)
|
||||
try:
|
||||
await client.request(
|
||||
"SYNO.Docker.Container",
|
||||
"pause",
|
||||
version=1,
|
||||
params={"name": json.dumps(resolved_name)},
|
||||
)
|
||||
return f"Paused container '{display_name}'."
|
||||
except Exception as e:
|
||||
return f"Error pausing container '{container_name}': {e}"
|
||||
|
||||
@mcp.tool()
|
||||
async def unpause_container(container_name: str):
|
||||
"""Unpause a paused container."""
|
||||
resolved_name = await _resolve_container_name(client, container_name)
|
||||
display_name = _strip_hash_prefix(resolved_name)
|
||||
try:
|
||||
await client.request(
|
||||
"SYNO.Docker.Container",
|
||||
"unpause",
|
||||
version=1,
|
||||
params={"name": json.dumps(resolved_name)},
|
||||
)
|
||||
return f"Unpaused container '{display_name}'."
|
||||
except Exception as e:
|
||||
return f"Error unpausing container '{container_name}': {e}"
|
||||
|
||||
|
||||
def _container_in_project(container: dict[str, Any], project_name: str) -> bool:
|
||||
"""Check if a container belongs to a project based on its labels."""
|
||||
|
||||
Reference in New Issue
Block a user