Add JSON output documentation and tool call examples to CLI help#141
Open
Add JSON output documentation and tool call examples to CLI help#141
Conversation
Document the JSON output shape (MCP object types) in --help for all commands that support --json, so AI agents know what to expect when scripting. tools-get now shows an example tools-call command with placeholder arguments derived from the tool's schema (required params first, filling optional up to 3). https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
macOS sed requires a backup extension argument with -i, unlike GNU sed. Use a temp file + mv instead for cross-platform compatibility. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
8c99c5c to
15e01cb
Compare
Document the JSON output shape (MCP object types) in --help for all commands that support --json, so AI agents know what to expect when scripting. tools-get now shows an example tools-call command with placeholder arguments derived from the tool's schema (required params first, filling optional up to 3). https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
macOS sed requires a backup extension argument with -i, unlike GNU sed. Use a temp file + mv instead for cross-platform compatibility. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
Extract formatToolHints() combining annotations + task support, used by both formatToolLine and formatToolDetail. tools-get now shows task:required or task:optional in the hints bracket. The tools-call example includes --task or [--task] accordingly. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
The v0.2.4 release emptied the README help code block and moved all changelog entries to the release section. Regenerate the help block and move unreleased entries to the new [Unreleased] section. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
15e01cb to
47a3c5d
Compare
…ub.com/apify/mcpc into claude/document-json-help-output-JjCWF
- mcpc @session cmd --help now shows command-specific help instead of the top-level help (was intercepted too early in main()) - mcpc @session --help now shows session command list - Capitalized "Display help" on all sub-commands (was lowercase default) - Added bold styling to Usage: and other titles in session command help - mcpc help <cmd> now uses the same styled session program https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
…ormatting
- tools-call help now shows how to pass arguments (key:=value, inline JSON,
stdin pipe) with concrete examples and auto-parsing notes
- Session grep help now includes type filters, examples, and --json output,
matching the top-level grep help
- All JSON output help text uses Markdown backtick formatting for type names
and shapes (e.g. Array of `Tool` objects: `[{ name, ... }]`)
- Dropped "MCP" prefix from type names (obvious from context)
- Extracted jsonHelp() helper to keep formatting consistent
https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
… text The jsonHelp() helper starts with \n, so when preceded by a blank line in the template literal, it produced a double blank line. Removed the redundant blank lines in tools-call, grep (both), connect, and clean. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
Match the top-level grep usage ordering by adding explicit .usage() so both show "grep <pattern> [options]" consistently. https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
For commands that return MCP protocol types, add a "Schema:" link to the respective type definition on the MCP specification page. This helps AI agents look up the full type definition when needed. Links added for: InitializeResult, Tool, CallToolResult, Resource, ReadResourceResult, ResourceTemplate, Prompt, GetPromptResult. No links for mcpc-specific objects (ping, close, login, etc.) or experimental types (Task). https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc
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
This PR enhances the CLI help system by adding comprehensive documentation for
--jsonoutput formats across all commands and providing practical usage examples for tool invocation.Key Changes
JSON output documentation: Added
.addHelpText()calls to 30+ commands documenting the exact shape of JSON objects returned when using the--jsonflag. This includes:connect,close,oauth-login,oauth-delete,cleanup,grephelp,tools,tools-list,tools-get,tools-call,tasks-*,resources-*,prompts-*,log-level,pingMCP InitializeResult,MCP Tool object, etc.)Tool call examples: Implemented
formatToolCallExample()function that generates practical usage examples for tools:minimumfor integerstools-getcommand to display example invocationComprehensive test coverage: Added 5 test cases for
formatToolCallExample()covering:Implementation Details
The
exampleValue()helper function intelligently generates placeholder values by checking in order:defaultpropertyenumarray (uses first value)['string', 'null'])The
formatToolCallExample()function respects the MCP tool schema structure and generates command-line syntax matching the existingtools-callcommand format withkey:=valueargument pairs.https://claude.ai/code/session_01JCmVVCvBbxPUrxy3BcgjCc