Skip to content

fix(gti-mcp): return API errors from create and update collection tools - #345

Open
VISHNU0906 wants to merge 1 commit into
google:mainfrom
VISHNU0906:fix/gti-collection-write-errors
Open

VISHNU0906 wants to merge 1 commit into
google:mainfrom
VISHNU0906:fix/gti-collection-write-errors

Conversation

@VISHNU0906

Copy link
Copy Markdown
Contributor

create_collection and update_collection_attributes return data["data"] from the GTI response without checking it. When the API sends back an error instead (403 for an account that can't create collections, 404 for an unknown collection id), the tool fails with

Error executing tool create_collection: 'data'

and the API's message never reaches the client.

This PR returns {"error": "API Error: <message>"} in that case, using the same data guard that get_collections_commonalities got in #335. The success path doesn't change.

Testing: new tests call both tools through the MCP client session against the pytest-httpserver mock, with a 403/404 error body, an error body without a message, and {"data": null}. All five cases fail on main with the 'data' error above. The full server/gti suite passes (77 tests).

@dandye could you take a look when you have a moment?

create_collection and update_collection_attributes read data["data"]
straight from the GTI response. When the API answers with an error
payload (403 for an account without collection access, 404 for an unknown
collection id), the tool fails with "Error executing tool ...: 'data'" and
the API's message is lost. Return an error dict with that message instead,
using the same data guard as get_collections_commonalities.

Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
@VISHNU0906
VISHNU0906 requested a review from a team November 10, 2026 03:25

This branch has not been deployed

No deployments
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