Bug Description
When using Claude models with OpenCode and the ACP (Agent Client Protocol) SDK, tool registration fails with:
This is distinct from #13618 (missing field on object schemas). This issue affects optional array parameters within schemas.
Root Cause
The ACP SDK's Zod schemas define optional array parameters without default values:
When Claude's strict JSON Schema validator processes this, the field becomes instead of , violating the array type requirement.
Affected Schemas
The following schemas in have optional array parameters without defaults:
| Schema |
Field |
|
|
|
|
|
|
|
|
|
, OPENCLAW_SERVICE_KIND=gateway |
| NODE_NO_WARNINGS=1 |
|
| PWD=/root/.openclaw/workspace |
|
| LOGNAME=root |
|
| SYSTEMD_EXEC_PID=2287751 |
|
| OPENCLAW_SHELL=exec |
|
| HOME=/root |
|
| LANG=en_US.UTF-8 |
|
| TMPDIR=/tmp |
|
| INVOCATION_ID=ccf5ed8fdd0d4116827ddb7fc403ef5a |
|
| MANAGERPID=572443 |
|
| OPENCLAW_GATEWAY_PORT=18789 |
|
| USER=root |
|
| OPENCLAW_SYSTEMD_UNIT=openclaw-gateway.service |
|
| SHLVL=0 |
|
| OPENCLAW_SERVICE_MARKER=openclaw |
|
| OPENCLAW_PATH_BOOTSTRAPPED=1 |
|
| OPENCLAW_WINDOWS_TASK_NAME=OpenClaw Gateway |
|
| XDG_RUNTIME_DIR=/run/user/0 |
|
| OPENCLAW_CLI=1 |
|
| OPENCLAW_SERVICE_VERSION=2026.4.10 |
|
| JOURNAL_STREAM=8:1247217910 |
|
| PATH=/root/.bun/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin:/root/.npm-global/bin:/root/bin:/root/.volta/bin:/root/.asdf/shims:/root/.nvm/current/bin:/root/.fnm/current/bin:/root/.local/share/pnpm |
|
| DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus |
|
| _=/usr/bin/env |
|
|
, |
|
|
|
, |
|
|
|
, |
Fix
Add to all optional array parameters in the Zod schemas:
Difference from #13618
Environment
- OpenCode: 1.14.20
- @agentclientprotocol/sdk: 0.19.0
- Model: Claude Opus 4.7 via API Pro
- Error occurs when ACP tools register with Claude
Verification
Tested with Claude Opus 4.7:
- Without fix:
- With fix: Tools register successfully, both GPT and Claude work correctly
Related
Bug Description
When using Claude models with OpenCode and the ACP (Agent Client Protocol) SDK, tool registration fails with:
This is distinct from #13618 (missing field on object schemas). This issue affects optional array parameters within schemas.
Root Cause
The ACP SDK's Zod schemas define optional array parameters without default values:
When Claude's strict JSON Schema validator processes this, the field becomes instead of , violating the array type requirement.
Affected Schemas
The following schemas in have optional array parameters without defaults:
Fix
Add to all optional array parameters in the Zod schemas:
Difference from #13618
Environment
Verification
Tested with Claude Opus 4.7:
Related