Skip to content

[Bug]: exec_container silently does nothing — wrong query param (env vs envId) #81

@sugarfunk

Description

@sugarfunk

MCP-Dockhand Version

1.2.0

Dockhand Server Version

1.0.29

Description

Dockhand version: latest (tested May 2026)
What's happening
exec_container appears to succeed — it returns an execId and connection info — but the command never actually runs inside the container.
Root cause
In src/tools/containers.ts, the exec call passes env in the query params:

return jsonResponse(await client.post(
  `/api/containers/${encodePath(containerId)}/exec`,
  body,
  { env: environmentId }
));

But POST /api/containers/{id}/exec expects envId, not env. Every other endpoint in the Dockhand API uses env, but exec is the odd one out. The request hits the wrong environment (or no environment), Docker exec never fires, and there's no error returned — just a silent no-op.
Fix
Pass envId instead of (or alongside) env:

return jsonResponse(await client.post(
  `/api/containers/${encodePath(containerId)}/exec`,
  body,
  { envId: environmentId, env: environmentId }
));

GitHub Copilot already flagged this exact change as an autofix suggestion on the repo, but it was marked outdated before it could be merged.
Steps to reproduce

Call exec_container with a valid container ID and environment ID
Pass a command with a side effect, e.g. ["sh", "-c", "echo test > /tmp/proof.txt"]
Try to read /tmp/proof.txt with get_container_file_content
File doesn't exist — command never ran

Impact
exec_container is completely non-functional as shipped. Any workflow relying on post-deploy commands (database migrations, seed scripts, etc.) will silently fail. The tool isn't listed in the README tool reference either — worth either fixing and documenting it, or explicitly marking it as unsupported.

Happy to test a fix if you want a 👍 from a real deployment before merging.

Expected Behavior

ability to run commands

Steps to Reproduce

above

MCP Transport

Streamable HTTP

Relevant Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions