Simplify evaluator notebook output with a <result uuid> marker#215
Merged
Conversation
Replace the verbose <internal>...<url>...</url></internal> notebook-URL marker with a compact <result uuid="..."> wrapper around the evaluation output, and shorten the session <system-reminder> to a single line. This applies to both WolframLanguageEvaluator and WolframAlpha, which share makeNotebookUIResult. Notebooks now deploy with CloudObjectNameFormat -> "UUID", so the deployed URL is already https://www.wolframcloud.com/obj/<uuid> (no extra Information round-trip) while keeping the hashed deploy path, so identical evaluations still dedup to one stable object. When a host drops _meta (ext-apps#696), each viewer reconstructs the same URL from the marker's uuid, and stripAgentOnlyText removes the <result> tags while preserving the wrapped result text. URL recovery now prefers the FIRST marker (the server prepends the opening tag), so a <result uuid="..."> string appearing in user evaluation output — which can only come after the server's tag — can no longer hijack the embedded URL. Tests and docs updated accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YXQ4f3K8pZyuMtV2aii21q
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the UI-enhanced tool result path for embedded notebooks by replacing the previous verbose, agent-facing URL marker with a compact <result uuid="...">…</result> wrapper that viewers can use to reconstruct the Wolfram Cloud notebook URL when _meta is dropped by the host.
Changes:
- Wrap cloud notebook tool output in
<result uuid="…">…</result>markers and add UUID extraction (cloudNotebookUUID) to support URL recovery. - Update the evaluator, Wolfram|Alpha, and notebook viewers to recover notebook URLs from the new marker and to strip the marker tags from displayed text.
- Refresh documentation and tests to match the new marker format and session reminder text.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/MCPApps.wlt | Updates marker tests to validate <result uuid="..."> wrapping and adds a cloudNotebookUUID extraction test. |
| Kernel/UIResources.wl | Implements result wrapping, UUID extraction, and configures cloud notebook deployment to return UUID-form URLs. |
| Kernel/Tools/WolframLanguageEvaluator.wl | Updates UI-result comment and shortens the session reminder text format. |
| Kernel/Tools/WolframAlpha.wl | Updates UI-result comment to reflect the new <result uuid> marker. |
| docs/mcp-apps.md | Documents the new marker format and UUID-based URL recovery behavior. |
| Assets/Apps/wolframalpha-viewer.html | Switches URL recovery/stripping logic from <internal><url> to <result uuid>. |
| Assets/Apps/notebook-viewer.html | Switches URL recovery logic from <internal><url> to <result uuid>. |
| Assets/Apps/evaluator-viewer.html | Switches URL recovery/stripping logic from <internal><url> to <result uuid>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Cleans up the
WolframLanguageEvaluator(andWolframAlpha) UI-path tool output when a notebook is embedded. The verbose agent-facing marker is replaced with a compact<result uuid="…">wrapper around the output, and the session reminder is shortened to one line.Before
After
How it works
CloudObjectNameFormat -> "UUID", so the deployed URL is alreadyhttps://www.wolframcloud.com/obj/<uuid>— no extraInformationround-trip. The hashed deploy path is kept, so identical evaluations still dedup to one stable object (same path → same UUID).makeNotebookUIResultwraps the content in<result uuid="…">…</result>(wrapResultTags);cloudNotebookUUIDpulls the uuid out of the deployed URL.evaluator,wolframalpha,notebook) reconstructs the identical cloud URL from the marker's uuid when a host drops_meta(ext-apps#696), andstripAgentOnlyTextremoves the<result>tags while preserving the inner result text.<result uuid="…">string appearing in user evaluation output — which can only come after the server's tag — can't hijack the embedded URL.Test plan
TestReportonMCPApps.wlt,EvaluatorSessions.wlt,WolframLanguageEvaluator-UI.wlt,WolframAlpha-UI.wlt— 158/158 pass. Includes the rewritten marker tests and a newcloudNotebookUUIDtest.CodeInspectorclean on the changed.wlfiles (only pre-existingFIXMEwarnings remain).Prime[123456789]through the updated pipeline produces exactly the "After" output, with_meta.notebookUrl's uuid matching the marker._meta, resists the injection case (server's real uuid wins), strips to cleanOut[1]= 2543568463, and returnsnullwhen no marker is present.🤖 Generated with Claude Code
https://claude.ai/code/session_01YXQ4f3K8pZyuMtV2aii21q