Description
When passing a valid absolute path to the directory parameter of opencode_run, opencode_ask, or opencode_fire, the validation rejects it with the error below — even when the path IS absolute and points to an existing directory.
Error: Invalid directory: "/mnt/d/Projects/opencode-agent" is not an absolute path.
Suggestions:
The directory parameter must be an absolute path to an existing directory
Example: /home/user/my-project (not ./my-project or ~/my-project)
/mnt/d/Projects/opencode-agent is absolute (starts with /) and refers to an existing, readable directory containing a valid project.
Environment
opencode-mcp : 1.10.1 (also reproduced via npx -y opencode-mcp@^1.10.1)
opencode server : 1.14.48 (healthy)
- MCP client : Claude Cowork (Anthropic desktop app), but reproducible from any MCP client
- Host OS : Windows
opencode serve runs in : WSL2 (Ubuntu)
Steps to reproduce
- Have
opencode serve running in WSL with a working directory like /mnt/d/Projects/SomeProjectA.
- Create another directory at
/mnt/d/Projects/SomeProjectB (with or without .git).
- From any MCP client, call:
{
"method": "opencode_run",
"params": {
"prompt": "git status",
"directory": "/mnt/d/Projects/SomeProjectB",
"agent": "build"
}
}
- Observe the error above. Same behavior with
opencode_ask and opencode_fire.
Expected
The directory parameter should accept any absolute path to an existing directory and switch the request's project context accordingly.
Workaround currently in use
Omit the directory parameter and prefix the prompt with an explicit cd:
{
"prompt": "cd /mnt/d/Projects/SomeProjectB && git status",
"agent": "build"
}
This works reliably but moves the context-switching responsibility from the MCP transport to the model/shell layer.
Hypothesis
The error message wording (mentioning ~/path and ./relative) suggests the validator was designed to reject those forms — but it appears to incorrectly trigger on valid absolute paths under WSL (/mnt/d/...) or when the target path differs from the opencode server's current working directory. Possibly a regex or path.isAbsolute()-style check that misfires.
Glancing at src/ would be useful — the check is likely in the params-validation layer for the workflow tools.
Why this matters
For MCP clients orchestrating multi-project workflows (delegating tasks across several repos), directory is the natural way to target a specific project per call. The cd workaround pollutes the prompt and isn't transparent for downstream tooling that inspects raw prompts.
Description
When passing a valid absolute path to the
directoryparameter ofopencode_run,opencode_ask, oropencode_fire, the validation rejects it with the error below — even when the path IS absolute and points to an existing directory.Error: Invalid directory: "/mnt/d/Projects/opencode-agent" is not an absolute path.
Suggestions:
The directory parameter must be an absolute path to an existing directory
Example: /home/user/my-project (not ./my-project or ~/my-project)
/mnt/d/Projects/opencode-agentis absolute (starts with/) and refers to an existing, readable directory containing a valid project.Environment
opencode-mcp: 1.10.1 (also reproduced vianpx -y opencode-mcp@^1.10.1)opencodeserver : 1.14.48 (healthy)opencode serveruns in : WSL2 (Ubuntu)Steps to reproduce
opencode serverunning in WSL with a working directory like/mnt/d/Projects/SomeProjectA./mnt/d/Projects/SomeProjectB(with or without.git).{ "method": "opencode_run", "params": { "prompt": "git status", "directory": "/mnt/d/Projects/SomeProjectB", "agent": "build" } }opencode_askandopencode_fire.Expected
The
directoryparameter should accept any absolute path to an existing directory and switch the request's project context accordingly.Workaround currently in use
Omit the
directoryparameter and prefix the prompt with an explicitcd:{ "prompt": "cd /mnt/d/Projects/SomeProjectB && git status", "agent": "build" }This works reliably but moves the context-switching responsibility from the MCP transport to the model/shell layer.
Hypothesis
The error message wording (mentioning
~/pathand./relative) suggests the validator was designed to reject those forms — but it appears to incorrectly trigger on valid absolute paths under WSL (/mnt/d/...) or when the target path differs from the opencode server's current working directory. Possibly a regex orpath.isAbsolute()-style check that misfires.Glancing at
src/would be useful — the check is likely in the params-validation layer for the workflow tools.Why this matters
For MCP clients orchestrating multi-project workflows (delegating tasks across several repos),
directoryis the natural way to target a specific project per call. Thecdworkaround pollutes the prompt and isn't transparent for downstream tooling that inspects raw prompts.