Skip to content

fix: surface error details from failed bulk edit operations#6

Open
zagah wants to merge 1 commit intobarryw:mainfrom
zagah:feat/bulk-edit-error-handling
Open

fix: surface error details from failed bulk edit operations#6
zagah wants to merge 1 commit intobarryw:mainfrom
zagah:feat/bulk-edit-error-handling

Conversation

@zagah
Copy link
Copy Markdown

@zagah zagah commented Apr 14, 2026

Summary

  • Changes BulkEditDocumentsAsync return type from Task<bool> to Task<(bool Success, string? Error)>
  • On failure, the error now includes the HTTP status code + response body (or exception message)
  • Updates both callers in DocumentTools.cs to include the error detail in the MCP response
  • Replaces PostAsJsonAsync<object> with StringContent + explicit runtime-type serialization to avoid base-type serialization dropping properties

Motivation

Currently a failed bulk edit silently returns false with no explanation. The MCP caller gets "Bulk operation failed" with no context. This change propagates the actual HTTP error (e.g. HTTP 400: {"detail": "Invalid tag ID"}) back to the caller.

Test plan

  • Build succeeds with zero warnings
  • Existing tests pass unchanged
  • Manual: trigger a bulk edit with an invalid document ID and verify the error message is now descriptive

🤖 Generated with Claude Code

Changes BulkEditDocumentsAsync return type from Task<bool> to
Task<(bool Success, string? Error)>. On failure the error now includes
the HTTP status code and response body (or exception message), which is
surfaced to the MCP caller rather than swallowed silently.

Also uses StringContent with explicit runtime-type serialization to
avoid the base-type serialization issue with PostAsJsonAsync<object>.
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.

1 participant