mcp: thread project arg through run_script and eval_expression#2701
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes MCP “compile-family” parity by threading the optional .das_project-backed project argument through the remaining subprocess-based tools (run_script, eval_expression), ensuring module resolution works consistently when invoking daslang.exe. It also updates MCP documentation tables and adds targeted tests to lock in focused validation errors for invalid project paths.
Changes:
- Add optional
projectparameter validation and-project <file>argv forwarding torun_scriptandeval_expression(including eval retry path). - Extend MCP tool schemas (
protocol.das) to expose theprojectproperty for both tools and pass it through dispatch. - Add tests covering both invalid-project error branches for
run_scriptandeval_expression, plus documentation updates (includinglive_commandsrow).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| utils/mcp/tools/run_script.das | Validates project and forwards it to daslang.exe via -project. |
| utils/mcp/tools/eval_expression.das | Adds project validation/forwarding and threads it through the retry/rewrite execution path. |
| utils/mcp/protocol.das | Adds project to tool schemas for run_script/eval_expression and passes it through dispatch. |
| utils/mcp/test_tools.das | Adds new unit tests ensuring focused errors for invalid project args in both tools. |
| utils/mcp/README.md | Documents project for run_script/eval_expression and adds live_commands to the live tools table. |
| doc/source/reference/utils/mcp.rst | Updates reference tables: documents project for execution tools and live_launch, and adds live_commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Every other compile-family MCP tool (compile_check, lint, aot, run_test, ast_dump, find_symbol, etc.) accepts an optional project : string pointing at a .das_project file for custom module resolution. run_script and eval_expression were the last two outliers — both shell out to daslang.exe (which supports -project) but never piped it through, so any script or expression that needed project-bound module resolution silently failed. - run_script.das / eval_expression.das: trailing project arg, validated via validate_project_arg, injected as -project <file> in argv before the script path. eval_expression also threads it through the daslib- rewrite retry. - protocol.das: PROJECT_PROP registered on both tool schemas; dispatch_tool passes the already-extracted project string. - test_tools.das: two new [test] functions mirroring the existing test_compile_check_invalid_project — exercise both validate_project_arg error branches (nonexistent path, wrong extension). - README.md / doc/source/reference/utils/mcp.rst: document the new arg on run_script + eval_expression, document the previously-shipped-but- undocumented project arg on live_launch, and add the missing live_commands row to the Live-Reload Control tables. Out of scope: removing daslang-live's single-instance lock + adding a -port CLI flag to unblock concurrent live instances (MCP-side port arg already exists on every live_* tool). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
10d4bd9 to
6fbfcfd
Compare
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
projectarg throughrun_scriptandeval_expressionMCP tools — the last two compile-family outliers that shell out todaslang.exebut never piped-project <file>through. Any script/expression that needed.das_project-bound module resolution silently failed.projectarg onlive_launch, and add the missinglive_commandsrow to the Live-Reload Control tables in bothutils/mcp/README.mdanddoc/source/reference/utils/mcp.rst.What changed
utils/mcp/tools/run_script.dasproject : string = ""param,validate_project_argearly-return,-project <file>argv injection.utils/mcp/tools/eval_expression.dasprojectthrough the daslib-requirerewrite retry path.utils/mcp/protocol.dasPROJECT_PROPadded to both tool schemas;dispatch_toolpasses the already-extractedprojectstring.utils/mcp/test_tools.das[test]functions mirroringtest_compile_check_invalid_project— exercise bothvalidate_project_argerror branches (nonexistent path, wrong extension) for both tools.utils/mcp/README.md+doc/source/reference/utils/mcp.rstlive_commandsrow inserted.Out of scope
Removing the
daslang-livesingle-instance OS-level lock and adding a-portCLI flag to unblock concurrent live instances. The MCP-side port arg already exists on everylive_*tool — once the executable cooperates, the MCP surface needs minimal further work. Tracking separately.Test plan
format_fileclean on every changed.dasfile (allalready_formatted).utils/lint/main.dasclean on all 4 changed.dasfiles (0 issues, 0 errors).compile_checkonutils/mcp/main.das— entry point compiles, everyrequirestill resolves.test_tools.das— 287/287 pass, including the two new tests:test_run_script_invalid_project✓test_eval_expression_invalid_project✓-Wclean (handwritten-RST surface — list-table edits, no toctree changes).🤖 Generated with Claude Code