Skip to content

fix(gti-mcp): keep the API error message when updating collection IOCs - #348

Open
VISHNU0906 wants to merge 1 commit into
google:mainfrom
VISHNU0906:fix/update-iocs-api-error
Open

VISHNU0906 wants to merge 1 commit into
google:mainfrom
VISHNU0906:fix/update-iocs-api-error

Conversation

@VISHNU0906

Copy link
Copy Markdown
Contributor

update_iocs_in_collection answered every non-200 response with a bare Error updating collection, so a missing collection, a 403 or a bad IOC all looked the same to the agent calling it. This is the same gap #345 closed for create_collection and update_collection_attributes.

It now keeps the GTI reason through the existing _api_error helper:

Error updating collection: API Error: Collection not found

A non-JSON error body (a proxy page, say) still gives Error updating collection: API Error: Unknown error. The success string is unchanged, and the status now comes from the public res.status instead of res._aiohttp_resp.status.

Tests go through call_tool with pytest-httpserver: a 404 on add, a 403 on remove (code only), and a 502 HTML body. All three fail on main; the full gti suite passes locally (82 tests).

@dandye

update_iocs_in_collection returned a bare 'Error updating collection' for
any non-200 response, so a missing collection or a permission error
looked the same to the caller. Include the GTI error message (or code)
through the same _api_error helper the other collection tools use, and
read the status from the public ClientResponse attribute.

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

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