[claude] Break up MCPBridge.run() into helper methods (#1135) #1148

Merged
claude merged 1 commits from claude/issue-1135 into main 2026-03-23 18:41:35 +00:00

1 Commits

Author SHA1 Message Date
Alexander Whitestone
7bc6e39a93 refactor: break up MCPBridge.run() into focused helper methods
Some checks failed
Tests / lint (pull_request) Failing after 15s
Tests / test (pull_request) Has been skipped
Extract connection setup/message building, tool-call round processing,
and the multi-round loop into three private helpers:
- _build_initial_messages() — static, constructs prompt message list
- _process_round_tool_calls() — executes one round of tool calls
- _run_tool_loop() — drives the multi-round loop, returns result tuple

run() is now ~35 lines of logic (down from 129), with error recovery
consolidated in a single return at the end.

Fixes #1135

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 14:38:38 -04:00