fix: Make docker_health use current instance port by default

docker_health now uses get_instance_port(port) like all other tools,
so it defaults to the current working instance when no port is specified.

Workflow:
1. docker_auto_start(binary) -> returns port
2. Poll docker_health(port=N) until healthy
3. instances_use(port=N) to set as current
4. All subsequent analysis calls omit port
This commit is contained in:
Ryan Malloy 2026-02-06 00:49:41 -07:00
parent d298a89f5f
commit 41bd8445e9

View File

@ -881,17 +881,18 @@ class DockerMixin(MCPMixin):
description="Check if a GhydraMCP container's API is responding", description="Check if a GhydraMCP container's API is responding",
) )
async def docker_health( async def docker_health(
self, port: int = 8192, timeout: float = 5.0, ctx: Optional[Context] = None self, port: Optional[int] = None, timeout: float = 5.0, ctx: Optional[Context] = None
) -> Dict[str, Any]: ) -> Dict[str, Any]:
"""Check if a GhydraMCP container's API is healthy. """Check if a GhydraMCP container's API is healthy.
Args: Args:
port: API port to check (default: 8192) port: API port to check (uses current instance if not specified)
timeout: Request timeout in seconds timeout: Request timeout in seconds
Returns: Returns:
Health status and API info if available Health status and API info if available
""" """
port = self.get_instance_port(port)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
return await loop.run_in_executor( return await loop.run_in_executor(
None, self._sync_health_check, port, timeout None, self._sync_health_check, port, timeout
@ -982,7 +983,7 @@ class DockerMixin(MCPMixin):
"container_name": start_result.get("name"), "container_name": start_result.get("name"),
"port": actual_port, "port": actual_port,
"api_url": f"http://localhost:{actual_port}/", "api_url": f"http://localhost:{actual_port}/",
"message": f"Container starting on port {actual_port}. Poll docker_health(port={actual_port}) to check when ready.", "message": f"Container starting on port {actual_port}. Poll docker_health(port={actual_port}), then call instances_use(port={actual_port}) when healthy.",
} }
@mcp_tool( @mcp_tool(