Remove temporary tool preview feature flag - #88
Draft
gandhipratik203 wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.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.
Summary
This removes the temporary
VITE_ENABLE_TOOL_PREVIEWflag and makes the Tools details drawer always render theTry it/Definitiontab layout.Changes:
Try itImportMetaEnvblockContext
Blocker
This PR is intentionally draft-only until the backend preview endpoint lands.
Removing the flag flips the production/default image path from Try-it hidden to Try-it visible. Since
/rpcexists but/tools/preview/{name}does not until IBM/mcp-context-forge#5629 lands, the post-removal production state would expose gated live invoke beside a Preview button that 404s.The current docker e2e gateway image is
ghcr.io/ibm/mcp-context-forge:v1.0.8, which predates the preview endpoint.Un-draft Gate
docker-compose.e2e.ymlis bumped to the firstghcr.io/ibm/mcp-context-forgerelease containingPOST /tools/preview/{name}.npm run e2e:dockerpasses against that image.Tests
git grep -n "VITE_ENABLE_TOOL_PREVIEW\|isToolPreviewEnabled" -- .- no tracked matchesnpm run lintnpm run format:check./node_modules/.bin/tsc -bnpm run testnpm run buildPLAYWRIGHT_SKIP_WEBSERVER=1 PLAYWRIGHT_BASE_URL=http://127.0.0.1:5173 npm run e2e -- e2e/tools.spec.ts -g "previews a tool|live invokes|confirms destructive|cancellation|tools.execute|servers.use|federated|denied passthrough"git diff --checkNot Run
npm run e2e:docker- blocked until the pinned gateway image contains [FEATURE][API]: Add tool preview endpoint for safe invocation dry-run IBM/mcp-context-forge#5629.Explanatory Diagrams
Try-it request flow
Manual Verification
Mock-backed happy-path verification was run for the default Tools Try-it drawer. This verifies frontend wiring only. A separate compatibility check against IBM/mcp-context-forge#6443 is documented below;
npm run e2e:dockerremains blocked until a released gateway image contains IBM/mcp-context-forge#5629.Manual verification steps
Setup
Save the mock script from the next collapsible at the repo root as
tool-try-it-happy-path-manual.mjs.Two terminals:
Terminal B opens a Chrome for Testing window with
/auth/session,/api/rbac/my/permissions,/api/tools,/api/gateways,/api/tools/preview/customer_lookup, and/api/rpcmocked. Ctrl-C in terminal B to close. Do everything in that window, in the tab it opens.Steps
1. Open More options for demo-tools -> View details.
Expect: the details drawer opens with Try it selected by default. This should work without setting
VITE_ENABLE_TOOL_PREVIEW.2. Fill
customer_idwithacme-001.Expect: the required argument is accepted by the schema form.
3. Leave
include_orderschecked if it defaults on, or toggle it on.4. Click Add header. Enter
X-Tenant-Idas the header name anddemo-teamas the value.5. Inspect the snippet tabs.
Expect:
curl,JSON-RPC,Python, andTypeScripttabs render with an MCP 2025-11-25 badge. Snippets target$MCPGATEWAY_URL/rpc, not browser-only/api/rpc, and do not includeserver_id.6. Click Preview.
Expect: Preview 200, Tool result, Resolved arguments, and Raw preview response. Terminal B should log
/api/tools/preview/customer_lookupwith the filled arguments andx-tenant-id: demo-team.7. Click Live invoke.
Expect: Live invoke 200, Tool result, the text
Live result: Acme Corp is active., and structured output containingcustomer_id,customer_name,status,include_orders, andtenant_header.8. Look at terminal B.
Expect:
/api/rpcrequest body hasmethod: "tools/call",params.name: "customer_lookup", the filled arguments, and noserver_id. The interesting headers log includesx-tenant-id: demo-team.Teardown
Ctrl-C both terminals. If :5173 is stuck:
Mock script (tool-try-it-happy-path-manual.mjs)
Save at the repo root. Requires
@playwright/test, already a dev dependency; runnpx playwright install chromiumif the browser is missing.Manual verification results
Mock-backed happy-path run completed against this PR branch.
VITE_ENABLE_TOOL_PREVIEWcustomer_id=acme-001andinclude_orders=trueare accepted and rendered in resolved arguments$MCPGATEWAY_URL/rpc, show MCP 2025-11-25, and omitserver_id/api/tools/preview/customer_lookupreturns Preview 200 with tool result, resolved arguments, and raw preview response/api/rpcreturns Live invoke 200 with text result and structured outputmethod: "tools/call",params.name: "customer_lookup", filled args, forwardedx-tenant-id, and noserver_idObserved UI output included Preview 200, Resolved arguments, Raw preview response, Live invoke 200, the text
Live result: Acme Corp is active., and structured output forAcme Corp.Scope of this verification: all backend responses are mocked. This covers frontend wiring only: default Try-it visibility after flag removal, schema argument form, snippets, preview request construction, live JSON-RPC request construction, passthrough headers, and result rendering. It does not verify a released gateway image; that remains part of the un-draft gate.
This integration test was run against IBM/mcp-context-forge#6443, the backend PR completing IBM/mcp-context-forge#5629. It verifies UI PR #88 against a real gateway backend plus a deterministic local REST target. Full
npm run e2e:dockeris still blocked until a releasedghcr.io/ibm/mcp-context-forgeimage contains that backend work.Integration test steps
Setup
Use sibling checkouts:
Save the script from the next collapsible at the UI repo root as
tool-try-it-real-backend-test.mjs.Run it from the UI repo:
cd /Users/pratik/Desktop/work/new_mcf/contextforge-web-ui node tool-try-it-real-backend-test.mjsThe script reuses healthy services if they are already running. Otherwise it starts:
JWT_SECRET_KEY=compat-test-jwt-secret-1234567890 AUTH_ENCRYPTION_SECRET=compat-test-auth-secret-1234567890 PASSWORD_CHANGE_ENFORCEMENT_ENABLED=false make dev127.0.0.1:9010127.0.0.1:3000github_issue_lookup_test_*Browser flow
1. Open
http://127.0.0.1:3000/app/tools.2. Log in with:
3. Open the REST tools card and select the generated
github_issue_lookup_test_*tool printed by the script.4. Confirm the drawer opens on Try it by default.
5. Fill the schema-generated arguments:
6. Click Preview.
Expect: Preview 200, Resolved arguments, and Raw preview response. The resolved arguments should include
owner,repo, andissue_number.7. Click Live invoke.
Expect: Live invoke 200 and a tool result containing issue #5630 details: title, state, labels, updated date, and summary.
Teardown
Keep the script process running during the manual test. Press Ctrl-C in that terminal when finished. It stops the services it started itself.
Integration test script (tool-try-it-real-backend-test.mjs)
Save at the UI repo root. The script assumes the backend checkout exists at
../mcp-context-forge; override withBACKEND_DIR=/path/to/mcp-context-forgeif needed.Integration test results
Compatibility run completed against:
feat/6322-remove-tool-preview-flag5629-tool-preview-endpoint-invoke-tool-endpointshttp://127.0.0.1:3000/app/toolshttp://127.0.0.1:9010/github/issuesPOST /tools/preview/{name}returns preview data withresolvedArgumentsPOST /rpcwithtools/callexecutes the REST tool and returns MCP content blocksPOST /api/tools/preview/{name}forwards through the session/CSRF proxyPOST /api/rpcforwards JSON-RPC live invoke through the BFFVITE_ENABLE_TOOL_PREVIEWresolvedArgumentsas Resolved argumentscontentresultObserved live result content:
{ "content": [ { "type": "text", "text": "{\n \"owner\": \"IBM\",\n \"repo\": \"mcp-context-forge\",\n \"issue_number\": 5630,\n \"title\": \"Add a Try-it experience for tools\",\n \"state\": \"open\",\n \"labels\": [\n \"tools\",\n \"ui\",\n \"mcp\"\n ],\n \"updated_at\": \"2026-08-31T18:20:00Z\",\n \"summary\": \"Adds a UI flow to preview tool arguments, run live tool calls, and inspect responses from the browser.\"\n}" } ], "isError": false }Observed UI output included Preview 200, Resolved arguments, Raw preview response, Live invoke 200, and a rendered MCP content block containing IBM/mcp-context-forge issue #5630 data.
Scope of this verification: this is a real gateway/BFF compatibility test against backend PR #6443, but the final tool target is a deterministic local REST endpoint instead of the public GitHub API. It validates the UI-to-BFF-to-gateway contract for Preview and Live invoke; released-image docker e2e remains part of the un-draft gate.