# A request-selected worktree root binds batch edits and rejects paths that escape it. stdin input.json exec semedit mcp --enable-batching stdout '"isError":false' stdout '"isError":true' stdout 'workspace_root' stdout 'invalid call_site.file' stdout 'invalid contract_file' stdout 'invalid members' cmp value.go want/main.go cmp .scratch/worktrees/selected/value.go want/worktree.go cmp .scratch/worktrees/other/value.go want/other.go cmp .scratch/worktrees/outside.go want/outside.go -- input.json -- {"jsonrpc":"2.0","id":1,"method":"initialize","params":{}} {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"semantic_replace_body","params":{"file":"value.go","symbol":"Value","body":"return 2"}}]}}} {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"semantic_replace_body","params":{"file":"../outside.go","symbol":"Outside","body":"return 9"}}]}}} {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"semantic_replace_body","params":{"workspace_root":".scratch/worktrees/other","file":"value.go","symbol":"Value","body":"return 8"}}]}}} {"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"refactor_inline_callable","params":{"file":"value.go","symbol":"inlineValue","call_site":{"file":"../outside.go","in_function":"Value","discriminator":"Outside()"}}}]}}} {"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"refactor_implement_contract","params":{"file":"value.go","symbol":"Worker","contract":"Runner","contract_file":"../outside.go","receiver_kind":"pointer","body_policy":"panic_stub"}}]}}} {"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"semantic_batch","arguments":{"workspace_root":".scratch/worktrees/selected","edits":[{"tool":"refactor_extract_interface","params":{"file":"value.go","symbol":"Runner","in_type":"Worker","receiver_kind":"pointer","members":[{"file":"../outside.go","symbol":"(*Worker).Run"}]}}]}}} -- go.mod -- module example.com/workspace-root go 1.23 -- value.go -- package workspace func Value() int { return 1 } -- .scratch/worktrees/selected/go.mod -- module example.com/selected-worktree go 1.23 -- .scratch/worktrees/selected/value.go -- package workspace func Value() int { return 1 } -- .scratch/worktrees/other/go.mod -- module example.com/other-worktree go 1.23 -- .scratch/worktrees/other/value.go -- package workspace func Value() int { return 3 } -- .scratch/worktrees/outside.go -- package workspace func Outside() int { return 7 } -- want/main.go -- package workspace func Value() int { return 1 } -- want/worktree.go -- package workspace func Value() int { return 2 } -- want/other.go -- package workspace func Value() int { return 3 } -- want/outside.go -- package workspace func Outside() int { return 7 }