Commit 2ceb9b8
committed
fix: resolve MCP tool validation errors in beta server
## Issue 1: Site publishing fails with customDomains validation error
**Error:**
```
"message": "Validation Error: [\"Value (customDomains)'s type should be array\"]",
"code": "validation_error"
```
**Root cause:**
Incorrect Zod chaining order in sites.ts. When `.default()` comes before
`.optional()`, the field can still be `undefined`, causing the Webflow API
to reject the request.
**Fix:**
Changed customDomains schema from:
```typescript
z.array(z.string()).default([]).optional()
```
To:
```typescript
z.array(z.string()).optional().default([])
```
This ensures customDomains always defaults to an empty array instead of
potentially being undefined.
**Files changed:**
- mcp-server-beta/src/tools/sites.ts
## Issue 2: Empty error messages in element_snapshot_tool
**Error:**
```json
{
"name": "Error",
"message": "",
"error": {}
}
```
**Root cause:**
When element_snapshot_tool's RPC call fails with an empty message, the error
handler creates `new Error("")`, resulting in unhelpful empty error messages.
**Fix:**
Added fallback error message with response details:
```typescript
new Error(
message ||
\`Element snapshot failed with status: \${status}. Response: \${JSON.stringify({ status, message, data })}\`
)
```
**Files changed:**
- mcp-server-beta/src/tools/deElement.ts
**Testing:**
These fixes target the beta server only for validation before rolling out
to stable.1 parent 6fd3183 commit 2ceb9b8
2 files changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
543 | 548 | | |
544 | 549 | | |
545 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | 82 | | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments