Add Kotlin tabs to the tool confirmation page - #2157
Open
happyhuman wants to merge 2 commits into
Open
Conversation
All three tab groups showed Python, TypeScript, Go and Java but not Kotlin, even though the API has existed since adk-kotlin v0.1.0. Kotlin turns out to sit closer to Python than to TypeScript here: the @tool annotation carries a requireConfirmation flag, so the boolean case is a direct equivalent of FunctionTool(require_confirmation=True) rather than something callers hand-roll. The flag is a compile-time constant, though, so dynamic thresholds are evaluated inside the tool through ToolContext, the way ADK Java does it. The prose that previously singled out TypeScript for that now names Kotlin too. The advanced example reads the returned payload through Number rather than casting straight to Int, because the payload arrives decoded from JSON and its numeric type is not guaranteed - the same trap the Go tab calls out for float64.
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The badge said Kotlin v0.8.0, the version adk-docs compiles against, rather than the introducing release. ToolConfirmation, ToolContext.requestConfirmation and the @tool requireConfirmation flag were all present at v0.1.0.
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.
What
Adds Kotlin to all three tab groups on
docs/tools-custom/confirmation.md(boolean, dynamic/threshold, advanced), plus theKotlin v0.1.0badge and two prose updates that previously listed every language except Kotlin.New snippets, both registered in
files_to_test.txt:examples/kotlin/snippets/tools/confirmation/ToolConfirmationExample.kt— boolean + advancedexamples/kotlin/snippets/tools/confirmation/dynamic/ReimbursementTools.kt— thresholdOne correction to the tracking notes
The backlog entry for this row said there is no confirmation support to mirror and warned against inventing one. The first half turned out to be wrong:
@Tool(requireConfirmation = true)exists at v0.8.0 and the KSP processor forwards it toFunctionTool(requiresConfirmation = ...). So the boolean tab is a direct equivalent of Python'sFunctionTool(require_confirmation=True), not a hand-rolled workaround. The warning itself still held — there is no separate confirmation tool type, and none was invented.Deliberate divergences from the sibling tabs
@Toolhas no predicate form, so the threshold is evaluated withToolContextexactly as the Java tab does. Called out in a note on the tab and in the section prose.Number.ToolConfirmation.payloadisAny?and arrives decoded from JSON, so its numeric type is not guaranteed. Casting straight toIntwould be a latentClassCastException; this is the same hazard the Go tab flags forfloat64.Why two files
@Toolgenerates a wrapper class named after the function, in the function's package. The boolean and threshold examples are both naturally calledreimburse, which would collide. Rather than rename one in a way that would read as meaningful, the threshold example lives in its own package — thepackageline sits outside the transcluded region, so both tabs show a plainly namedreimburse.Verification
Grounded against the
v0.8.0git tag. Full ladder green (L0, L1 compile with KSP, L2 ktlint, L3, L5, L6). L4runSnippetsreports SKIP — no such Gradle task exists in this repo.Tracked as KT-24.
Update: the badge originally read
Kotlin v0.8.0, which is the version adk-docs compiles against, not the release the feature shipped in. Corrected to the introducing version, matching the sibling badges and the rest of the site.