Skip to content

fix(mcp): let addZoom take customScale without depth - #1356

Merged
EtienneLescot merged 1 commit into
mainfrom
fix/mcp-zoom-customscale
Oct 20, 2026
Merged

EtienneLescot merged 1 commit into
mainfrom
fix/mcp-zoom-customscale

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

addZoom and addZooms refused a zoom set with customScale alone. A free level could only be set in two calls: add the zoom, then setZoom.

Cause.

  • addZoomArgs gave depth a schema default of 3.
  • The MCP server, the in-app agent and addZooms all parse the arguments through that schema before the tool runs, so the default was already filled in when the handler started.
  • The handler's guard against passing both depth and customScale then saw two levels and refused the call.
  • Direct calls with raw arguments, which the existing tests use, never hit it.

Fix. The default moves into the handler, where it applies only when neither level is given. depth stays 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: addZoom with customScale alone was refused.

Type of change

  • Bug fix

Release impact

  • Patch

Desktop impact

  • Not platform-specific

Testing

  • New test in agent-tools.test.ts, which covers three cases:
    • addZoom with arguments already parsed by addZoomArgs, as the MCP server passes them;
    • addZooms with a region that carries customScale alone;
    • a zoom with neither level, which still gets depth 3.
      It failed before the fix and passes after.
  • Test runs: npx vitest --run electron/ai-edition electron/mcp gives 605 tests passing over 26 files.
  • Checks: npx tsc --noEmit, npx tsc -p tsconfig.test.json --noEmit and npm run lint are clean (no new warnings).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved zoom configuration handling when a custom scale is provided.
    • Preserved the default zoom depth of 3 when no zoom settings are specified.
    • Ensured consistent behavior for both individual and batch zoom operations.

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.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c64ea5e4-2280-44ce-812e-f81e10d03c87
📥 Commits

Reviewing files that changed from the base of the PR and between 3c9bd5d and 6c83411.

📒 Files selected for processing: 2
  • electron/ai-edition/agent-tools.test.ts
  • electron/ai-edition/agent-tools.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The zoom argument schema now leaves depth unset when omitted. The addZoom handler defaults depth to 3 only when both depth and customScale are absent. Tests cover custom-scale arguments and the default case.

Changes: Zoom argument handling

Layer / File(s) Summary
Parse and apply zoom arguments
electron/ai-edition/agent-tools.ts, electron/ai-edition/agent-tools.test.ts
The schema no longer inserts depth 3 during parsing. The handler supplies depth 3 when both depth and customScale are absent. Tests cover custom-scale arguments for addZoom and addZooms, plus the default case.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: auberginewly

Merge Risk: ⚪ Minimal · up to 6c834

No actionable merge-blocking risk remains in the reviewed change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: allowing addZoom to use customScale without depth.
Description check Passed The description includes the change summary, issue context, change type, release impact, platform impact, and detailed testing results. The omitted Screenshots / video section is not required because …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the change summary, issue context, change type, release impact, platform impact, and detailed testing results. The omitted Screenshots / video section is not required because this is not a UI or visual change.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot
EtienneLescot merged commit 1e91710 into main Oct 20, 2026
20 checks passed
@EtienneLescot
EtienneLescot deleted the fix/mcp-zoom-customscale branch October 20, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant