Files
Toni Klopfenstein 27e1303857 Kotlin snippets fixes (#1770)
* Migrating from Map to typed data classes in FuncTool and LongRunningTool kotlin examples

* lint cleanup of kotlin snippets

* adding gradle wrapper for kotlin snippets

* cleaning up build file for kotlin

* fixing ktlint_code_style, added focus on included Gradle Wrapper

---------

Co-authored-by: Kristopher Overholt <koverholt@google.com>
2026-05-19 15:29:44 -05:00

26 lines
777 B
Kotlin

package com.google.adk.kt.examples.tools
import com.google.adk.kt.annotations.Param
import com.google.adk.kt.annotations.Tool
// --8<-- [start:optional_params]
class FlightService {
/**
* Searches for flights.
*/
@Tool
fun searchFlights(
@Param("The destination city.") destination: String,
@Param("The desired departure date.") departureDate: String,
@Param("Number of flexible days for the search. Defaults to 0.") flexibleDays: Int? = 0,
): String {
// ... function logic ...
val days = flexibleDays ?: 0
if (days > 0) {
return "Found flexible flights to $destination."
}
return "Found flights to $destination on $departureDate."
}
}
// --8<-- [end:optional_params]