github mksglu/context-mode v1.0.139

latest release: v1.0.140
2 hours ago

v1.0.139

Closes the OpenCode native-bridge validation gap — input schemas are now enforced before tool handlers run, matching the behavior MCP clients get for free.

Fix

OpenCode native bridge now validates tool input (#621). PRs #574/#597 added a native fast-path for OpenCode that bypasses the MCP stdio transport entirely — it calls registered tool handlers directly. The MCP SDK normally runs safeParseAsync against each tool's Zod inputSchema at server/mcp.js:174 before invoking the handler. The native path skipped that step, so:

  • z.preprocess(coerceCommandsArray, …) on ctx_batch_execute.commands never fired → JSON-stringified args or bare-string commands crashed with opaque commands.map is not a function.
  • Missing required fields surfaced as runtime TypeErrors instead of clear "Invalid arguments" messages.

v1.0.139 runs inputSchema.parse(args) inside buildNativeTools before invoking the handler. Validation failures surface as Invalid arguments for <tool>: <zod error path + reason>. Behavior is now byte-equivalent between the native fast-path and the MCP stdio path. Closes #621.

Tests

5 new tests in existing tests/opencode-plugin.test.ts (CONTRIBUTING L275 — no new test files):

  • baseline well-formed args still pass through
  • JSON-stringified commands array coerced
  • bare-string commands lifted to {label, command}
  • missing commands raises a clear validation error (not a TypeError)
  • JSON-stringified queries on ctx_search coerced

All targeted: 5/5 pass. Full impacted suite preserves baseline.

Compatibility

15 adapters, 3 OS. No schema migration. engines.node >= 22.5.0 preserved.

Upgrade

npm install -g context-mode@latest
# Restart Claude Code (Cmd+Q + reopen) — `/reload-plugins` alone won't pick up the new MCP server.

Credits

  • Reporter who flagged #621 with a precise hypothesis pointing at the post-#574/#597 path
  • @acarpath (#587) + #622 reporter — separate AMFI race already resolved in v1.0.136 (PR #591), #622 closed as duplicate

Don't miss a new context-mode release

NewReleases is sending notifications on new releases.