Add debug_container_response tool for DSM response inspection
Temporary debug tool that returns the raw SYNO.Docker.Container/get response as JSON directly in the MCP tool output — visible in chat without needing to inspect Claude Desktop logs. To be removed once get_container_status is fixed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -108,6 +108,29 @@ def register_containers(mcp: FastMCP, config: AppConfig, client: DsmClient) -> N
|
|||||||
|
|
||||||
return "\n".join(lines).rstrip()
|
return "\n".join(lines).rstrip()
|
||||||
|
|
||||||
|
@mcp.tool()
|
||||||
|
async def debug_container_response(container_name: str) -> str:
|
||||||
|
"""TEMPORARY DEBUG TOOL — returns raw SYNO.Docker.Container/get response as JSON.
|
||||||
|
|
||||||
|
Used to inspect the actual DSM response structure so that
|
||||||
|
get_container_status can be fixed to read the correct fields.
|
||||||
|
Remove once the real fix is in place.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
container_name: Name of the container to inspect.
|
||||||
|
"""
|
||||||
|
clean_name = _strip_hash_prefix(container_name)
|
||||||
|
try:
|
||||||
|
data = await client.request(
|
||||||
|
"SYNO.Docker.Container",
|
||||||
|
"get",
|
||||||
|
params={"name": clean_name},
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
return f"Error calling SYNO.Docker.Container/get for '{clean_name}': {e}"
|
||||||
|
|
||||||
|
return json.dumps(data, indent=2, default=str)
|
||||||
|
|
||||||
@mcp.tool()
|
@mcp.tool()
|
||||||
async def get_container_status(container_name: str) -> str:
|
async def get_container_status(container_name: str) -> str:
|
||||||
"""Get detailed status, uptime, and resource usage of a container.
|
"""Get detailed status, uptime, and resource usage of a container.
|
||||||
|
|||||||
Reference in New Issue
Block a user