Repository navigation
fix(mcp): let addZoom take customScale without depth - #1356
Conversation
addZoom's schema gave depth a default of 3. The MCP server, the in-app agent and addZooms all parse the arguments through that schema before the tool runs, so a call with customScale alone arrived with depth: 3 filled in, and the guard against passing both levels refused it. A free level could only be set by adding the zoom, then calling setZoom. The default moves into the handler, where it applies only when neither level is given.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
addZoomandaddZoomsrefused a zoom set withcustomScalealone. A free level could only be set in two calls: add the zoom, thensetZoom.Cause.
addZoomArgsgavedeptha schema default of 3.addZoomsall parse the arguments through that schema before the tool runs, so the default was already filled in when the handler started.depthandcustomScalethen saw two levels and refused the call.Fix. The default moves into the handler, where it applies only when neither level is given.
depthstays optional in the schema, with the default named in its description. Passing both levels is still refused.Related issue
None filed. Found while editing a demo through OpenScreen's MCP:
addZoomwithcustomScalealone was refused.Type of change
Release impact
Desktop impact
Testing
agent-tools.test.ts, which covers three cases:addZoomwith arguments already parsed byaddZoomArgs, as the MCP server passes them;addZoomswith a region that carriescustomScalealone;It failed before the fix and passes after.
npx vitest --run electron/ai-edition electron/mcpgives 605 tests passing over 26 files.npx tsc --noEmit,npx tsc -p tsconfig.test.json --noEmitandnpm run lintare clean (no new warnings).🤖 Generated with Claude Code
Summary by CodeRabbit