Skip to content

fix: fix busy-times 400 errors, surface full API error bodies, and fix booking location schema#75

Merged
sahitya-chandra merged 1 commit intomainfrom
fix/busy-times-and-error-surfacing
Apr 7, 2026
Merged

fix: fix busy-times 400 errors, surface full API error bodies, and fix booking location schema#75
sahitya-chandra merged 1 commit intomainfrom
fix/busy-times-and-error-surfacing

Conversation

@sahitya-chandra
Copy link
Copy Markdown
Member

Summary

  • get_busy_times was always returning HTTP 400 because query params were sent as flat credentialId/externalId instead of the nested calendarsToLoad[0][credentialId]/calendarsToLoad[0][externalId] format that the Cal.com v2 controller expects. Also added bracket-decoding in buildUrl so URLSearchParams doesn't percent-encode [/].
  • API error responses were opaque — MCP clients only saw "Error 400: Cal.com API error (400)" with no details. Now the full response body is included, and error messages are extracted from both body.message and body.error fields.
  • Booking location schema accepted plain strings but the Cal.com API only accepts specific location objects. Changed
    to object-only with a description listing all 8 valid types.

…x booking location schema

- calendars.ts: use nested bracket-notation query params (calendarsToLoad[0][credentialId], etc.)
  as required by the Cal.com v2 busy-times controller, instead of flat credentialId/externalId
- api-client.ts: decode %5B/%5D back to literal brackets in URLs so NestJS parses nested params
- api-client.ts: extract error messages from both body.message and body.error fields
- tool-helpers.ts: include full API response body in error messages so MCP clients can debug 400s
- bookings.ts: change location schema from string|object to object-only per OpenAPI spec,
  with description listing all 8 valid location types
- register-tools.ts: improve get_busy_times tool description with clearer workflow and date format
- Updated tests to match new bracket-notation params and error handling behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sahitya-chandra sahitya-chandra enabled auto-merge (squash) April 7, 2026 19:15
@sahitya-chandra sahitya-chandra merged commit ad317f7 into main Apr 7, 2026
11 checks passed
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.

2 participants