From f68f4911db22bcb52075467c2ac67294767af662 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt <2812720+tleonhardt@users.noreply.github.com> Date: Thu, 3 Dec 2026 14:18:16 -0500 Subject: [PATCH] Document lookup paths, bounded help, and UTF-8 handling in the MCP example --- ...-mcp-server-example-implementation-plan.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plans/2026-12-01-mcp-server-example-implementation-plan.md b/plans/2026-12-01-mcp-server-example-implementation-plan.md index c79416e..d82bad7 100644 --- a/plans/2026-12-01-mcp-server-example-implementation-plan.md +++ b/plans/2026-12-01-mcp-server-example-implementation-plan.md @@ -2626,6 +2626,26 @@ What is left needs the maintainer, and is not to be assumed done: _Added on 2026-12-02. Everything above this section is the plan as it was written and revised. This section records what was done with it._ +**Subcommand lookup and rendering** +([cmd2 commit `dfb92d47`](https://github.com/python-cmd2/cmd2/commit/dfb92d47)). + +- Append the subcommand's `typed` spelling to its parent's lookup path. This distinguishes the + single subcommand in `report "list all"` from the nested subcommand in `report list all`. + `list_commands` also returns the typed spellings. +- Use the child usage to construct the actual invocation. For a parser with a `user` positional + before its subcommands, `owner alice -- -x` dispatches to the subcommand described by `owner -x`. + A preceding positional can consume the end-of-options marker even when the child itself is named + `--`. From-file expansion still happens before option parsing. +- When an argument in a child usage prefix has more than 1,000 choices, rebuild the prefix from the + bounded display parser. Descendant usage and help then show the argument's metavar. Configure the + formatter and its Rich console for 100 columns on the display copy. The rebuild leaves the process + environment alone. +- Escape lone surrogate code points as printable text at the snapshot boundary. A default or alias + containing an undecodable filesystem byte can then be returned in a UTF-8 MCP response. + +On macOS, all 196 SDK-required example tests passed on Python 3.11.18 and 3.15.2. On 3.15.2 the full +suite passed with 3,426 tests and 3 skips, and both `make check` and `make docs-test` passed. + **Parser, snapshot, and server behavior at [`db54d52d`](https://github.com/python-cmd2/cmd2/commit/db54d52d).**