MCP: Runcode, upgrade, compile - #6236
Open
bbarker wants to merge 7 commits into
Open
Conversation
Contributor
Author
|
This is ready for review 🙇♂️ |
naga-zoom
added a commit
to naga-zoom/unison
that referenced
this pull request
Jun 10, 2026
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.
Overview
Supersedes #6233
Adds three enhancements to the MCP tool surface:
Optional
codeparameter forrun— When provided, the source is typechecked first and the specified definition is run from the typechecked file without updating the codebase. Enables AI agents to iterate on code in a single tool call without polluting the project namespace.New
compiletool — Compiles a Unison definition to a standalone.ucfile viaMakeStandaloneI. The file is written relative to the codebase directory and can be executed withucm run.compiled.New
lib-upgradetool — Upgrades a library dependency from one version to another viaUpgradeI, equivalent tolib.upgrade old newin UCM.Also fixes the Nix flake by adding
filelocktodontCheckoverrides (its test suite is flaky under the Nix sandbox).Implementation approach and notes
RunToolArgumentsgainscode :: Maybe (Either FilePath Text)(optional in JSON schema). Handler branches oncode:Nothing→ existing behavior;Just source→ delegates towithCode.CompileToolArgumentstakesprojectContext,mainFunctionName, andoutputPath; handler issuesMakeStandaloneI.LibUpgradeToolArgumentstakesprojectContext,oldLibName,newLibName; handler issuesUpgradeI [old, new].handleInputMCPpattern as existing tools.Interesting/controversial decisions
compileoutput path is passed as-is toMakeStandaloneI(which appends.uc). UCM writes the file relative to the codebase dir, not to an arbitrary absolute path — this is a UCM constraint, documented in the tool description.lib-upgradetakes a single old/new pair rather than the variadic form UCM supports. Sufficient for agent use; can be extended later.runwithcodereuseswithCoderather than duplicating typecheck logic — keeps the handler thin.Test coverage
mcp-run-with-code.mdadded covering: run withoutcode(missing definition error), run with inlinesourceCode, and run withfilePath.mcp-compile-upgrade.mdadded covering: compile success, compile with missing definition, and lib-upgrade with missing old library../scripts/proofs/formatting.shand./scripts/proofs/transcripts.sh) — CI attestation checks pass.Loose ends
lib-upgradeonly supports a single old→new pair; variadic form could be added later.Final checklist
.cabalfiles not changed (only.hsand transcript.md)