diff --git a/plugins/communication_protocols/http/pyproject.toml b/plugins/communication_protocols/http/pyproject.toml index dbe2d32..cbd0ed8 100644 --- a/plugins/communication_protocols/http/pyproject.toml +++ b/plugins/communication_protocols/http/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "utcp-http" -version = "1.0.2" +version = "1.0.3" authors = [ { name = "UTCP Contributors" }, ] diff --git a/plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py b/plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py index 199c76e..68de65e 100644 --- a/plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py +++ b/plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py @@ -313,7 +313,11 @@ async def call_tool(self, caller, tool_name: str, tool_args: Dict[str, Any], too content_type = response.headers.get('Content-Type', '').lower() if 'application/json' in content_type: - return await response.json() + try: + return await response.json() + except Exception: + logger.error(f"Error parsing JSON response from tool '{tool_name}' on call template '{tool_call_template.name}', even though Content-Type was application/json") + return await response.text() return await response.text() except aiohttp.ClientResponseError as e: