fix: surface API error details in client, CLI and MCP #1

Merged
troed merged 1 commit from devel into main 2026-08-26 14:18:53 +02:00
Owner

MCP schedule calls that failed validation (e.g. a script_path outside the roster host's [scripts] allowlist) surfaced as a bare "Error executing tool schedule" — the FastAPI {"detail": ...} body was swallowed by httpx.HTTPStatusError. This makes validation feedback impossible to debug from an MCP client.

  • client.py: new RosterAPIError raised on >=400 with the API's detail (falls back to raw text); replaces all ten raise_for_status() call sites
  • cli.py: API errors and unreachable-API errors print one clean error: ... line instead of tracebacks
  • mcp_server.py: schedule description now states that jobs run on the machine hosting the roster API and that script_path/gate must be executables inside that host's [scripts] dir
  • README.md: new "Where jobs run" section; roster.toml.example: allowlist comment
  • tests/test_client.py: regression test that a 422 detail reaches RosterAPIError

After this, the same failure reads: error: roster API 422: script path '/tmp/x.sh' is outside the allowlist dir '/home/.../.config/roster/scripts'.

MCP `schedule` calls that failed validation (e.g. a `script_path` outside the roster host's `[scripts]` allowlist) surfaced as a bare "Error executing tool schedule" — the FastAPI `{"detail": ...}` body was swallowed by `httpx.HTTPStatusError`. This makes validation feedback impossible to debug from an MCP client. - `client.py`: new `RosterAPIError` raised on >=400 with the API's `detail` (falls back to raw text); replaces all ten `raise_for_status()` call sites - `cli.py`: API errors and unreachable-API errors print one clean `error: ...` line instead of tracebacks - `mcp_server.py`: `schedule` description now states that jobs run on the machine hosting the roster API and that `script_path`/`gate` must be executables inside that host's `[scripts]` dir - `README.md`: new "Where jobs run" section; `roster.toml.example`: allowlist comment - `tests/test_client.py`: regression test that a 422 `detail` reaches `RosterAPIError` After this, the same failure reads: `error: roster API 422: script path '/tmp/x.sh' is outside the allowlist dir '/home/.../.config/roster/scripts'`.
fix: surface API error details in client, CLI and MCP
All checks were successful
CI / Sanity check (ubuntu-latest) (push) Successful in 31s
CI / Sanity check (ubuntu-latest) (pull_request) Successful in 23s
b0fd5e1e7c
- client: raise RosterAPIError with the API's detail body instead of
  httpx.HTTPStatusError (which dropped it)
- cli: print 'error: roster API <status>: <detail>' and clean
  cannot-reach messages instead of raw tracebacks
- mcp_server: schedule description documents that jobs run on the
  roster API host and script paths must live in its [scripts] dir
- README: new 'Where jobs run' section; toml.example allowlist note
- test: regression test for 422 detail propagation
troed merged commit 316272296e into main 2026-08-26 14:18:53 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starfleet/roster!1
No description provided.