Skip to main content

Module json

Module json 

Source
Expand description

Every value the porcelain prints under --json — the machine face, as pure unit-tested builders. [crate::render] owns the human strings; this module owns the JSON mirror. Shapes serialize the mcpmesh-local/1 result types verbatim wherever one exists (additive discipline: an absent field means empty/none, same as the wire), plus small hand-built objects for verbs with no API result. One JSON value per invocation on stdout; a failure is one {"error":{"code":…,"message":…}} line on stderr.

Functions§

doctor_json
doctor --json: every finding, plus the warn/error tallies the human summary line carries and an overall ok (false iff any ERROR — mirrors the exit code).
error_json
The --json error object: the SAME human message [render::error_lines] produces (joined, without the leading “Error: “), plus the control-API JSON-RPC code when the failure came from the daemon — the machine-branchable field the human path deliberately hides.
invite_json
invite --json: the InviteResult verbatim plus the requested services (what the operator asked to grant — the same provenance as the human line).
pair_json
pair --json: the PairResult verbatim plus the ready-to-use <peer>/<service> mount targets (the machine mirror of “You can now use: …”).
serve_json
serve --json.
status_json
status --json: the StatusResult verbatim, plus the Hello fields and the device fingerprint the human header carries. Hello’s api/stack fields win over StatusResult’s stack_version copy (they are the same value from a live daemon).
unpair_json
pair --remove --json.
up_json
up --json.
use_json
use --json: per service, the mount target, the exact Claude Code command, and the generic MCP stdio server entry (name/command/args) any client can consume — the machine mirror of [crate::proxy::client_instruction_lines].