Add explicit show_ui parameter to UI-enabled write tools#2601
Open
mattdholloway wants to merge 5 commits into
Open
Add explicit show_ui parameter to UI-enabled write tools#2601mattdholloway wants to merge 5 commits into
mattdholloway wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an explicit show_ui boolean input parameter for MCP App form-backed write tools (issue write + pull request creation), allowing callers to opt out of the interactive UI flow and execute requests directly, while keeping the parameter hidden from non-UI-capable clients via per-request schema stripping in the inventory layer.
Changes:
- Added
show_uitoissue_writeandcreate_pull_requestschemas and routing logic to allow explicitly bypassing the MCP Apps form (show_ui=false). - Extended inventory registration-time stripping to also remove UI-only input-schema properties (like
show_ui) under the same gate that strips_meta.ui. - Added/updated tests, toolsnaps, and generated docs to cover and document the new parameter and gating behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/inventory/registry.go | Applies UI-gated schema stripping (show_ui) alongside existing _meta.ui stripping during registration. |
| pkg/inventory/registry_test.go | Adds unit tests for schema-property stripping and verifies show_ui is stripped/kept under the same gate as _meta.ui. |
| pkg/inventory/builder.go | Implements schema-property stripping helpers and the UI-only property allowlist (show_ui). |
| pkg/github/pullrequests.go | Adds show_ui to create_pull_request schema and uses it to optionally bypass the UI-form routing. |
| pkg/github/pullrequests_test.go | Adds coverage for show_ui=true/false behavior across UI/non-UI clients and submission scenarios. |
| pkg/github/issues.go | Adds show_ui to issue_write schemas and uses it to optionally bypass the UI-form routing for create/update. |
| pkg/github/issues_test.go | Adds coverage for show_ui=true/false behavior across UI/non-UI clients and submission scenarios. |
| pkg/github/toolsnaps/issue_write.snap | Updates snapshot to include show_ui in the tool schema. |
| pkg/github/toolsnaps/issue_write_ff_remote_mcp_issue_fields.snap | Updates feature-flagged snapshot to include show_ui in the tool schema. |
| pkg/github/toolsnaps/create_pull_request.snap | Updates snapshot to include show_ui in the tool schema. |
| docs/insiders-features.md | Updates generated docs to include show_ui for the relevant tools. |
| docs/feature-flags.md | Updates generated docs to include show_ui (and reflects related schema doc output changes). |
Copilot's findings
- Files reviewed: 12/12 changed files
- Comments generated: 4
Today the server decides whether to route issue_write and create_pull_request
through the MCP App form using two implicit signals: _ui_submitted (set by
the form on submit) and a heuristic that bypasses the form when the call
carries any parameter the form cannot represent (labels, assignees,
issue_fields, state, reviewers, etc.). The model had no first-class,
documented way to say "execute directly, do not show a form".
Add a show_ui boolean parameter to the input schema of IssueWrite,
LegacyIssueWrite, and CreatePullRequest. It defaults to true and is
visible only to clients that advertise MCP App UI support: the strip
happens per-request in inventory.ToolsForRegistration via a new
stripUIOnlySchemaProperties helper, gated by the same predicate that
already strips _meta.ui (shouldStripMCPAppsMetadata). The two strips share
one decision so the schema and metadata stay in lock-step.
Form-routing predicate becomes:
MCPApps FF on && client supports UI &&
!_ui_submitted && show_ui && !hasNonFormParams
show_ui=false is a new explicit way for the model to opt out. The existing
non-form-param auto-bypass stays as a safety net, and the React forms keep
sending _ui_submitted=true on submit unchanged. get_me is out of scope
because its UI is pure client-side card rendering with no server-side
gating to replace.
The current strip gate ("strip when FF is off OR capability explicitly
absent") mirrors today's _meta.ui behavior exactly, including the
"capability unknown" case. For stdio that means UI-capable schemas are
exposed to any FF-enabled client. The handler-side clientSupportsUI check
still gates form execution at call time, so it is functionally a no-op for
non-UI stdio clients. A separate follow-up will tighten the gate to
"strip on unknown too" and wire an InitializedHandler in stdio to
re-register the un-stripped surface only after a UI-capable client has
advertised; the two changes must ship together to avoid breaking stdio.
docs/feature-flags.md and docs/insiders-features.md include an unrelated
"reviewers" description update picked up by script/generate-docs from
commit 2bd162a ("fix: support team pull request reviewers"), which
updated the source schema but did not regenerate docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The code comments next to the show_ui schema entries (and the uiOnlySchemaProperties allowlist) said the property is documented in "toolsnaps / README". README is generated from the stripped (non-UI) schema, so show_ui is not actually in it — it only appears in toolsnaps and the feature-flag / insiders docs. Reword the comments to match reality. Comment-only change; no behavior or test impact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The form-routing logic depends on a hand-maintained classification of each schema property into form-resendable vs known-non-form. A new property added without updating the classification would silently shift UI gating behavior (e.g. a form-incompatible param wouldn't trigger the safety-net bypass). Add Test_issueWriteSchemaClassification and Test_createPullRequestSchemaClassification that enumerate each tool's InputSchema.Properties and require every property to be classified as exactly one of: - form-resendable (member of issueWriteFormParams / pullRequestWriteFormParams) - known-non-form (test-local allowlist) A future schema addition without classification fails the test with a message pointing at the exact set the contributor needs to update. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7c8510a to
0f2ad87
Compare
Previously `show_ui` was listed in docs/feature-flags.md and
docs/insiders-features.md alongside ordinary parameters with no
indication that it is hidden from clients without MCP App UI support.
A reader scanning the parameter list would assume it is always available.
Add a programmatic conditional-property mechanism:
- `inventory.ConditionalSchemaPropertyDescriptions()` exposes a
map[propertyName]conditionDescription derived from the same
uiOnlySchemaProperties allowlist that drives the per-request strip
in ToolsForRegistration. Single source of truth.
- The doc generator (writeToolDoc) consults this map and appends
"conditional — <description>" to the parameter's parenthesised
type/required suffix.
Example rendered output:
- `show_ui`: Whether to render the MCP App form... (boolean, optional,
conditional — only visible to clients that advertise MCP App UI support)
A small test (TestConditionalSchemaPropertyDescriptions) ensures every
entry in uiOnlySchemaProperties has a description, so a future stripped
property addition can't silently lose its doc marker.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
This pull request adds a new
show_uiboolean parameter to the GitHub MCP App issue and pull request creation/update APIs. This parameter allows clients to explicitly control whether to show the interactive MCP App form or to execute the request directly, improving flexibility and user experience, especially for automated or pre-confirmed actions.