Menu

#5 cloud_activity_command: .min(1) prevents clearing the field

closed
nobody
None
2026-04-23
2026-03-24
Anonymous
No

Originally created by: kumaakh
Originally owned by: joiskash

Problem

update_member schema has cloud_activity_command: z.string().min(1) but the description says "pass empty string to clear." The .min(1) validator rejects empty strings at the Zod level, so the documented clearing path is unreachable.

The code at update-member.ts:84 (input.cloud_activity_command || undefined) would handle empty string correctly if it could get past validation, but it never will.

Design discussion

  • Omit the field = "don't change it" (already works, field is optional)
  • Empty string "" = valid JSON, MCP transports it faithfully (JSON-RPC), Zod would see it
  • Removing .min(1) would let "" through → code converts to undefined → field cleared

Open question: is empty string the right UX for "clear"? Alternatives:

  • Remove .min(1) and let "" mean "clear" (simplest, code already handles it)
  • Add a cloud_activity_command_clear: boolean field (explicit but more complex)
  • Change description to not promise clearing via empty string

Recommendation

Remove .min(1). The code path already handles ""undefined. One character deleted, no behavior change needed downstream.

Priority: LOW

User-facing but edge case — most users set the command once and don't clear it.

Source

Code review Round 3, finding [#1]. File: src/tools/update-member.ts:31

Related

Tickets: #1
Tickets: #166

Discussion

  • Anonymous

    Anonymous - 2026-03-24
     
  • Anonymous

    Anonymous - 2026-04-23

    Originally posted by: kumaakh

    Fixed in main: PR [#166] (commit ca30df) removed the .min(1) validator from cloud_activity_command in src/tools/update-member.ts. An empty string now passes Zod validation and the existing input.cloud_activity_command || undefined logic converts it to undefined, clearing the field as originally documented.

     

    Related

    Tickets: #166

  • Anonymous

    Anonymous - 2026-04-23

    Ticket changed by: kumaakh

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB