This commit is contained in:
Timothy Jaeryang Baek
2026-04-24 18:38:57 +09:00
parent 3560d2f630
commit f48b8ffbf0
3 changed files with 67 additions and 9 deletions
+9
View File
@@ -1164,6 +1164,15 @@ async def process_tool_result(
'url': file_url,
}
)
elif item.get('type') == 'resource':
resource = item.get('resource', {})
text = resource.get('text', '')
if isinstance(text, str) and text:
try:
text = json.loads(text)
except json.JSONDecodeError:
pass
tool_response.append(text)
tool_result = tool_response[0] if len(tool_response) == 1 else tool_response
else: # OpenAPI
for item in tool_result: