mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-03 03:35:02 -05:00
### Description fix: Surface Dataplex API errors in MCP results This change addresses issue https://github.com/googleapis/genai-toolbox/issues/2203, where Dataplex API errors, such as '403 Forbidden' (Permission Denied), were not being properly surfaced in the MCP tool results. Previously, these critical API errors would manifest as generic "connection interrupted" messages, significantly hindering developer debugging and trust in the Toolbox. The fix enhances the error handling within the 'dataplexsearchentries' and 'dataplexsearchaspecttypes' tools. When an error occurs during the iteration of Dataplex API results, the system now: Utilizes 'google.golang.org/grpc/status.FromError' to attempt to convert the returned error into a gRPC status. This is crucial because Google Cloud client libraries often return errors compatible with gRPC. If the error is a gRPC status, the canonical error code (e.g., 'codes.PermissionDenied') and the associated error message are extracted. This ensures that users receive clear actionable error feedback, allowing for quicker diagnosis and resolution of issues like missing IAM permissions. This aligns with best practices for API error surfacing, improving the usability and reliability of the Dataplex tools within the GenAI Toolbox. Fixes https://github.com/googleapis/genai-toolbox/issues/2203 ## PR Checklist > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #<issue_number_goes_here> --------- Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com> Co-authored-by: Averi Kitsch <akitsch@google.com>