hanzo-mcp 0.9.2__py3-none-any.whl → 0.9.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hanzo-mcp might be problematic. Click here for more details.

@@ -450,6 +450,9 @@ AGENT RESPONSES:
450
450
  tool_call_count = len(message.tool_calls)
451
451
  await tool_ctx.info(f"Processing {tool_call_count} tool calls")
452
452
 
453
+ # Track which tool calls we've processed to ensure all get results
454
+ tool_results_to_add = []
455
+
453
456
  for tool_call in message.tool_calls:
454
457
  total_tool_use_count += 1
455
458
  function_name = tool_call.function.name
@@ -542,8 +545,8 @@ AGENT RESPONSES:
542
545
  await tool_ctx.info(
543
546
  f"tool {function_name} run with args {function_args} and return {tool_result[: min(100, len(tool_result))]}"
544
547
  )
545
- # Add the tool result to messages
546
- messages.append(
548
+ # Add the tool result to the list
549
+ tool_results_to_add.append(
547
550
  {
548
551
  "role": "tool",
549
552
  "tool_call_id": tool_call.id,
@@ -552,6 +555,9 @@ AGENT RESPONSES:
552
555
  }
553
556
  )
554
557
 
558
+ # Add all tool results to messages atomically
559
+ messages.extend(tool_results_to_add)
560
+
555
561
  # Log progress
556
562
  await tool_ctx.info(f"Processed {len(message.tool_calls)} tool calls. Total: {total_tool_use_count}")
557
563
 
@@ -559,6 +565,41 @@ AGENT RESPONSES:
559
565
  await tool_ctx.error(f"Error in model call: {str(e)}")
560
566
  # Avoid trying to JSON serialize message objects
561
567
  await tool_ctx.error(f"Message count: {len(messages)}")
568
+
569
+ # CRITICAL FIX: Ensure we add tool_result messages for any tool_use blocks that were added
570
+ # Get the last assistant message (which has the tool_calls)
571
+ last_assistant_msg = None
572
+ for msg in reversed(messages):
573
+ if msg.get("role") == "assistant" and hasattr(msg, "tool_calls"):
574
+ last_assistant_msg = msg
575
+ break
576
+
577
+ # If there are orphaned tool calls, add error results for them
578
+ if last_assistant_msg and hasattr(last_assistant_msg, "tool_calls"):
579
+ # Count how many tool results we already have after this message
580
+ tool_results_count = 0
581
+ found_assistant = False
582
+ for msg in reversed(messages):
583
+ if msg == last_assistant_msg:
584
+ found_assistant = True
585
+ break
586
+ if found_assistant and msg.get("role") == "tool":
587
+ tool_results_count += 1
588
+
589
+ # Add error results for any missing tool calls
590
+ expected_results = len(last_assistant_msg.tool_calls)
591
+ if tool_results_count < expected_results:
592
+ for i in range(tool_results_count, expected_results):
593
+ tool_call = last_assistant_msg.tool_calls[i]
594
+ messages.append(
595
+ {
596
+ "role": "tool",
597
+ "tool_call_id": tool_call.id,
598
+ "name": tool_call.function.name,
599
+ "content": f"Error: Tool execution interrupted - {str(e)}",
600
+ }
601
+ )
602
+
562
603
  return f"Error in agent execution: {str(e)}"
563
604
 
564
605
  # If we've reached the limit, add a warning and get final response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hanzo-mcp
3
- Version: 0.9.2
3
+ Version: 0.9.3
4
4
  Summary: The Zen of Hanzo MCP: One server to rule them all. The ultimate MCP that orchestrates all others.
5
5
  Author-email: Hanzo Industries Inc <dev@hanzo.ai>
6
6
  License: MIT
@@ -29,7 +29,7 @@ hanzo_mcp/tools/__init__.py,sha256=RZVr_s1Jnc1cCGcDU2FYKtPqZrTWa-ME9umPixl2YaU,1
29
29
  hanzo_mcp/tools/agent/__init__.py,sha256=K5fWO3MSpMoTHiP38qvZJ9VhOQQlFwSgIPI9fRWtIX4,4879
30
30
  hanzo_mcp/tools/agent/agent.py,sha256=FeWBHGkexpp50Ya7pA8APoHK4ZchDhIDh7eWEX_axDA,13038
31
31
  hanzo_mcp/tools/agent/agent_tool.py,sha256=ysNrkoEd4L2t32f0yS9sa7xFS9cDN6XzzQh2d2v3yfI,16801
32
- hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py,sha256=m86qZC4FmNvRckKXcQlpw6N2hmQsUduzyizhenDG5Ps,26228
32
+ hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py,sha256=k-GoD6JS6GvPAJu4PPQrWy6VQVdWXGa2P1eB9LfBT9k,28353
33
33
  hanzo_mcp/tools/agent/clarification_protocol.py,sha256=QYJTmDSJVRDyZMow80TxWmnJurxuLo1MaIFge8t_Yvk,8041
34
34
  hanzo_mcp/tools/agent/clarification_tool.py,sha256=sye5Y7F8IOaDNh3ZHmcSDGPBJog9-ZJdutV2hGHc1vQ,2674
35
35
  hanzo_mcp/tools/agent/claude_cli_tool.py,sha256=55Wc0LKgYCtDKQ02NXOYPMhx-sW7fL_NSCx0upsvvb4,3812
@@ -188,8 +188,8 @@ hanzo_mcp/tools/vector/project_manager.py,sha256=usxOldFajm7UN-74yN7Qa5Xw7Or6EWm
188
188
  hanzo_mcp/tools/vector/vector.py,sha256=KMV1UHH6kCgTrglyLSfepbDDgOo6U3QMXpsCBQyq5to,9963
189
189
  hanzo_mcp/tools/vector/vector_index.py,sha256=Vtdx69DwtsCaokleBhUpaFhP9AQ6Lq7C6xsDbZjPqNY,4274
190
190
  hanzo_mcp/tools/vector/vector_search.py,sha256=bRy-Dcm0SsJD7eV99U_XMdSpenh5WAPimqXofrTNIwE,9402
191
- hanzo_mcp-0.9.2.dist-info/METADATA,sha256=A-fO9hk-M-C-XECxPrB8SfbZyJy4vSdK51mgiGzjf88,8974
192
- hanzo_mcp-0.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
193
- hanzo_mcp-0.9.2.dist-info/entry_points.txt,sha256=ML30pedHV5wjthfztzMMz3uYhNdR_6inzYY5pSqNME4,142
194
- hanzo_mcp-0.9.2.dist-info/top_level.txt,sha256=eGFANatA0MHWiVlpS56fTYRIShtibrSom1uXI6XU0GU,10
195
- hanzo_mcp-0.9.2.dist-info/RECORD,,
191
+ hanzo_mcp-0.9.3.dist-info/METADATA,sha256=YUL8XY22uipXy32CewjqmECQVEc411pKoAE9lWvqWdk,8974
192
+ hanzo_mcp-0.9.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
193
+ hanzo_mcp-0.9.3.dist-info/entry_points.txt,sha256=ML30pedHV5wjthfztzMMz3uYhNdR_6inzYY5pSqNME4,142
194
+ hanzo_mcp-0.9.3.dist-info/top_level.txt,sha256=eGFANatA0MHWiVlpS56fTYRIShtibrSom1uXI6XU0GU,10
195
+ hanzo_mcp-0.9.3.dist-info/RECORD,,