fix: use .[][].name in jq for wrapped JSON response #31

Merged
michal merged 1 commits from fix/completion-jq-wrapped-json into main 2026-02-23 19:27:03 +00:00
Owner

Summary

  • API returns { "resources": [...] } not bare arrays, so .[].name silently produced no output
  • Fix: use .[][].name to unwrap the outer object then iterate the array
  • Tests updated to guard against both the old regex bug and the single-bracket .[].name mistake
  • Also: pr.sh now auto-loads .env (no need to source .env first)

Test plan

  • 283 CLI tests pass
  • Verified mcpctl get projects -o json | jq -r '.[][].name' returns only project names
  • Verified mcpctl get servers -o json | jq -r '.[][].name' returns only server names
## Summary - API returns `{ "resources": [...] }` not bare arrays, so `.[].name` silently produced no output - Fix: use `.[][].name` to unwrap the outer object then iterate the array - Tests updated to guard against both the old regex bug and the single-bracket `.[].name` mistake - Also: `pr.sh` now auto-loads `.env` (no need to `source .env` first) ## Test plan - [x] 283 CLI tests pass - [x] Verified `mcpctl get projects -o json | jq -r '.[][].name'` returns only project names - [x] Verified `mcpctl get servers -o json | jq -r '.[][].name'` returns only server names
michal added 1 commit 2026-02-23 19:26:56 +00:00
fix: use .[][].name in jq for wrapped JSON response
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / package (pull_request) Has been cancelled
ec7ada5383
API returns { "resources": [...] } not bare arrays, so .[].name
produced no output. Use .[][].name to unwrap the outer object first.
Also auto-load .env in pr.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
michal merged commit 9a5deffb8f into main 2026-02-23 19:27:03 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: michal/mcpctl#31