Skip to content

feat(mcp): add --json mode to pipeboard mcp - #15

Merged
nictuku merged 1 commit into
mainfrom
nictuku/davao-v2
Apr 21, 2026
Merged

nictuku merged 1 commit into
mainfrom
nictuku/davao-v2

Conversation

@nictuku

@nictuku nictuku commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds --json persistent flag on pipeboard mcp (applies to both tools-list and tools-call).
  • Emits a clean structured envelope on stdout, suppresses status chatter on stderr, and silences cobra usage so parsers do not have to scan for the first {.
  • Auto-unwraps the MCP content[].text wrapper and parses inner JSON when possible, so callers no longer need to double-parse.

Shape

  • Success: {"ok": true, "data": <parsed>}
  • Tool-level error (isError: true): {"ok": false, "error": "...", "data": "..."} + exit 1
  • Transport / auth / network error: {"ok": false, "error": "..."} + exit 1
  • tools-list --json: {"ok": true, "total": N, "tools": [...]}

Motivation

Pipes like this used to need manual text munging and two-step parsing:

pipeboard mcp --server meta-ads-mcp tools-call --tool get_creative_details --args '{...}' 2>&1 > out
python -c "idx=raw.find('{'); d=json.loads(raw[idx:]); inner=json.loads(d['content'][0]['text']) ..."

Now:

pipeboard mcp --json --server meta-ads-mcp tools-call --tool get_creative_details --args '{...}' | jq '.data.object_story_spec.page_id'

Test plan

  • go build ./...
  • go vet ./...
  • go test ./cmd/... (4 new tests cover unwrap, isError, passthrough, error envelope)
  • Smoke test with a bogus token returns {"ok": false, "error": "..."} and exit 1

Adds a --json flag to pipeboard mcp that emits a clean structured envelope
on stdout and suppresses status messages. The MCP content[].text wrapper
is auto-unwrapped and parsed as JSON when possible, so callers no longer
need to hunt for the start of the JSON in the output or double-parse
content[0].text themselves.

Success: {"ok": true, "data": <parsed>}
Tool-level error (isError=true): {"ok": false, "error": "...", "data": "..."} + exit 1
Transport/auth error: {"ok": false, "error": "..."} + exit 1
@nictuku
nictuku merged commit aa18be7 into main Apr 21, 2026
2 checks passed
@nictuku
nictuku deleted the nictuku/davao-v2 branch April 21, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant