Skip to content

docs(cli): add comprehensive error documentation to public functions#140

Merged
bug-ops merged 3 commits into
masterfrom
mcp-cli-public-cli-functions
Jul 9, 2026
Merged

docs(cli): add comprehensive error documentation to public functions#140
bug-ops merged 3 commits into
masterfrom
mcp-cli-public-cli-functions

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Added comprehensive # Errors documentation sections to all public Result-returning functions in the mcp-cli crate, removing the crate-level #![allow(clippy::missing_errors_doc)] suppression that was masking lint warnings.

Changes

  • completions.rs: Documented run() — function cannot fail (always returns success)
  • formatters.rs: Added error docs to nested formatters:
    • json::format and json::format_compact — may fail if JSON serialization fails
    • text::format — propagates JSON serialization errors
    • pretty::format — may fail if JSON serialization or formatting fails
  • runner.rs: Improved error documentation:
    • init_logging() — can fail if tracing subscriber initialized multiple times
    • execute_command() — comprehensive list of failure modes (config, connection, I/O, serialization)
  • server.rs: Enhanced run() error docs with explicit failure conditions
  • main.rs: Removed #![allow(clippy::missing_errors_doc)] suppression

Verification

  • ✅ Rustdoc: No broken intra-doc links
  • ✅ Clippy: No missing_errors_doc warnings with -D warnings
  • ✅ Format: cargo +nightly fmt passes
  • ✅ Tests: 260 tests pass

References

Closes #126

Handoff file

Added # Errors sections to all public Result-returning functions in mcp-cli:
- completions: documented run() which cannot fail
- formatters: added error docs to json/text/pretty format functions
- runner: improved init_logging() and execute_command() with specific errors
- server: enhanced run() error documentation

Removed the crate-level #![allow(clippy::missing_errors_doc)] suppression.

Fixes #126
@github-actions github-actions Bot added area: cli CLI commands and interface crate: mcp-cli Changes to mcp-cli crate (command-line interface) type: documentation Documentation changes (*.md, docs/, comments) breaking change Contains breaking API changes (requires major version bump) release Release preparation (changelog, version bumps) labels Jul 9, 2026
bug-ops added 2 commits July 9, 2026 18:04
Fixed four issues identified by reviewer:

1. completions.rs: Added backticks to \`clap_complete\` (doc_markdown clippy lint)
2. runner.rs: Rewrote init_logging() error docs to clarify it cannot fail and
   panics (rather than returning Err) on double-init
3. server.rs: Updated run() error docs to clarify that introspection failures
   are caught internally and reported via ExitCode::ERROR, not Err
4. formatters.rs: Clarified pretty::format() error documentation - only
   serialization can fail, not the value formatting itself

All verification checks pass:
- Rustdoc: no broken intra-doc links
- Clippy: no warnings with -D warnings
- Format: all files properly formatted
- Tests: 260 tests pass
The prior review-fix commit dropped the "named server not found"
bullet entirely from server::run's Errors section. It only applies
to the Validate action internally caught error; for the Info action,
get_mcp_server propagates as Err via `?`, so the bullet was a real
error path and needed to stay, scoped correctly per action.
@bug-ops
bug-ops enabled auto-merge (squash) July 9, 2026 16:10
@bug-ops
bug-ops merged commit 2c9b2b7 into master Jul 9, 2026
17 checks passed
@bug-ops
bug-ops deleted the mcp-cli-public-cli-functions branch July 9, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI commands and interface breaking change Contains breaking API changes (requires major version bump) crate: mcp-cli Changes to mcp-cli crate (command-line interface) release Release preparation (changelog, version bumps) type: documentation Documentation changes (*.md, docs/, comments)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp-cli: public CLI functions lack comprehensive error documentation

1 participant