What this thread does
JsonParseException: Unrecognized token 'r': change the tool parameter from char to String and validate its length before converting it.
A valid one-letter argument can fail before your tool runs; a digit can instead reach it as the wrong character. Report #6932
Do first: accept String letter, require letter.length() == 1, then call letter.charAt(0) inside the tool. This workaround follows the executor's separate String conversion branch.
Not for: Continue with DeepSeek interleaved tool arguments; see continue-deepseek-tool-arguments-interleaved.
What changed
- The schema represents
char/Characteras a JSON string, but the reported executor path parses the extracted string as JSON text again. A letter throws;"1"becomes U+0001. This is reported for 1.23.0, not established as a newly introduced regression. #6932 - Proposed fix #6933 adds explicit one-character conversion for arguments and defaults. It remains open.
Do first: keep the tool boundary as String
Replace the parameter type and perform the conversion in your own method:
@Tool
int countLetter(
@P(name = "word") String word,
@P(name = "letter") String letter) {
if (letter == null || letter.length() != 1) {
throw new IllegalArgumentException("letter must have length 1");
}
char target = letter.charAt(0);
return (int) word.chars().filter(c -> c == target).count();
}
The executor source returns a String argument through argument.toString() before the JSON-deserialization fallback. That is the basis for this workaround; it does not require changing the model's JSON output.
If the parameter has a fallback, retain the text boundary: @P(defaultValue = ",") String separator, followed by the same validation and conversion. The official tools guide documents literal String defaults and says defaults apply only when an argument is absent.
Diagnostic: JsonParseException: Unrecognized token 'r'
Check a letter, a digit, an omitted default, an empty string and a two-character string. Include an assertion on the actual character value: absence of an exception does not establish correct conversion. juunghyun's example sends "2" while counting digits and reports an incorrect zero result: “wrong value and no error is reported.” #6932
Version and scope
The 1.23.0 release is dated October 28, 2026. The November 2 PR #6933 describes regression cases for primitive and boxed characters, but does not establish a released correction.
This snippet deliberately accepts one Java UTF-16 code unit. A supplementary Unicode character needs a different contract, such as a code point represented by an int; it cannot fit in one Java char. Java String documentation The workaround's application-specific outcomes are not established by the report.
Started from a post by @juunghyun, packaged by the editor. Original post