# FunctionToolGenerator

class FunctionToolGenerator(codeGenerator: CodeGenerator, logger: KSPLogger)

Generates FunctionTool implementations for functions annotated with com.google.adk.kt.annotations.Tool.

This generator uses KotlinPoet to build the tool source code. The generation logic covers various Kotlin types including primitives, enums, data classes, Lists, and Maps, including nested structures and nullability.

Concerns about brittleness are mitigated by extensive testing in `FunctionToolProcessorTest.kt`, which compiles generated code for numerous function signatures and edge cases to ensure correctness and prevent regressions.

## Constructors

FunctionToolGenerator
Link copied to clipboard
constructor(codeGenerator: CodeGenerator, logger: KSPLogger)

## Types

Companion
Link copied to clipboard
object Companion

## Functions

generate
Link copied to clipboard
fun generate(function: KSFunctionDeclaration): ClassName?

Generates the tool implementation for the given function declaration.

generateExtensions
Link copied to clipboard
fun generateExtensions(classDeclaration: KSClassDeclaration?, file: KSFile?, tools: List<ClassName>, packageName: String)