Skip to content

cli: --app-info probe + --format json envelope #1574

Description

@cliffhall

Summary

App-probing and machine-readable output for the CLI:

  • --method tools/call --tool-name <t> --app-info — prints one JSON line describing the tool's app posture (hasApp, resourceUri, csp, permissions, …) without invoking the tool; exits 0 when the tool has an app, 2 (no_app) when it doesn't — so a shell pipeline can short-circuit before touching a browser.
  • --method tools/list --app-info — one NDJSON line per tool with its _meta.ui posture, over a single connect.
  • --format json — a single JSON envelope on stdout (result + appInfo as sibling keys, no banner) for any method.

Reference implementation (PR #1510)

Re-implement informed by these changes at 33fac3f:

Depends on

  • core AppInfo + extractAppInfo()
  • CLI exit-code map + error envelopes (NO_APP = 2 via CliExitCodeError)
  • mcp_app_demo test-server preset (live fixture for the tests)
  • CLI ergonomics issue (same cli.ts lane; land first)

--format json and --app-info are combined here because emitResult() branches on both — splitting them creates an artificial seam.

Notes

  • Resource-read failures during the probe should be tolerated and reported in a resourceError field, not thrown.
  • Document --app-info, --format json, NDJSON shape, and the exit-2 semantics in clients/cli/README.md.
  • Coverage gate ≥90 on all four dimensions.

Part of the PR #1510 decomposition (see tracking issue).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions