refactor: centralize client tool result construction - #217
Merged
Conversation
PaulAsjes
approved these changes
Jul 20, 2026
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 10:29
e5f6f76 to
3ca038f
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
2 times, most recently
from
July 20, 2026 13:38
d722e0f to
e58d3c8
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
2 times, most recently
from
July 20, 2026 15:54
2924c48 to
e88b2d0
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 16:20
e88b2d0 to
e4f8248
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 16:40
e4f8248 to
5034ee6
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
3 times, most recently
from
July 20, 2026 21:29
47a03ee to
eadd79b
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 21:53
eadd79b to
9dfd832
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 22:32
9dfd832 to
6eea761
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 20, 2026 23:28
6eea761 to
0001a68
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 21, 2026 10:51
0001a68 to
2d43478
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 21, 2026 12:28
2d43478 to
1200edb
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 21, 2026 23:02
1200edb to
c919259
Compare
renal128
marked this pull request as ready for review
July 21, 2026 23:04
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 22, 2026 13:21
c919259 to
07b86cd
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 22, 2026 15:33
07b86cd to
7f4c635
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 23, 2026 09:06
7f4c635 to
069c41d
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
July 23, 2026 09:10
069c41d to
97d8172
Compare
jacksonh
approved these changes
Aug 3, 2026
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 15:47
97d8172 to
352ac92
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 16:38
352ac92 to
e6e9a64
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 18:33
e6e9a64 to
6c92aa7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6c92aa7. Configure here.
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 18:38
6c92aa7 to
2428c5e
Compare
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 18:44
2428c5e to
4e4bbca
Compare
Let ClientToolResultEvent own string and Encodable result creation so the client and session expose one focused send method. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
renal128
force-pushed
the
simplify-client-tool-results
branch
from
August 4, 2026 18:49
4e4bbca to
de20107
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
EncodablesendToolResultoverloads with one method acceptingClientToolResultEvent.ClientToolResultEventinitializer while preserving verbatim string construction.Test plan
swiftformat 'Sources' 'Tests' --lint --strictswift testNote
Medium Risk
Breaking public API for tool results and callbacks; behavior is straightforward but every integrator must update call sites. No auth or connection-path changes.
Overview
sendToolResultonConversationandConversationClientnow takes a singleClientToolResultEventinstead of separatefor/result/isErroroverloads. Callers build results withClientToolResultEvent.init(...)— string payloads stay verbatim;Encodablevalues are JSON-encoded via a new throwing initializer on the event type.The client-tool callback is renamed from
onUnhandledClientToolCalltoonClientToolCall, and incomingclientToolCallevents invoke that callback (not only “unhandled” cases). README, Usage docs, and tests follow the event-based pattern.Reviewed by Cursor Bugbot for commit de20107. Bugbot is set up for automated code reviews on this repo. Configure here.