This repository was archived by the owner on Jun 3, 2026. It is now read-only.
fix: return empty content array for null/undefined tool results#1097
Open
serhiizghama wants to merge 2 commits into
Open
fix: return empty content array for null/undefined tool results#1097serhiizghama wants to merge 2 commits into
serhiizghama wants to merge 2 commits into
Conversation
Void/null-returning tools were producing TextBlock('<undefined>') and
TextBlock('<null>') — strings that look like placeholders and are not
valid JSON. Side-effectful tools that don't return a value should
signal success with an empty content array instead.
Update existing tests to expect empty content arrays instead of '<null>'/'<undefined>' placeholders. Add a dedicated void-callback test covering the common side-effectful tool pattern.
lizradway
pushed a commit
to lizradway/sdk-typescript
that referenced
this pull request
Jun 1, 2026
Collaborator
|
This repository has been merged into the strands-agents/harness-sdk monorepo and will be archived shortly. All new development happens there. If this PR is still relevant, please recreate it against the monorepo. The code now lives under Apologies for the disruption, and thank you for contributing! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
When a tool callback returns
nullorundefined(void/side-effectful tools),_wrapInToolResultwas producing aTextBlockwith the placeholder text'<null>'or'<undefined>'. These strings:json.dumps(None)→"null")Fixes strands-agents/harness-sdk#2529.
Solution
Replace the separate
nullandundefinedhandlers with a single combined check that returns an empty content array:An empty content array correctly signals success without a misleading placeholder. This matches the common expectation for side-effectful tools.
Testing
nullandundefinedtest cases to assertcontent: []voidcallback test covering the real-world side-effectful tool pattern (see issue example withgreet)