docs(cli): add comprehensive error documentation to public functions#140
Merged
Conversation
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
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
enabled auto-merge (squash)
July 9, 2026 16:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added comprehensive
# Errorsdocumentation 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
run()— function cannot fail (always returns success)json::formatandjson::format_compact— may fail if JSON serialization failstext::format— propagates JSON serialization errorspretty::format— may fail if JSON serialization or formatting failsinit_logging()— can fail if tracing subscriber initialized multiple timesexecute_command()— comprehensive list of failure modes (config, connection, I/O, serialization)run()error docs with explicit failure conditions#![allow(clippy::missing_errors_doc)]suppressionVerification
-D warningsReferences
Closes #126
Handoff file