# AppFunctionSchemaDefinition

Artifact: [androidx.appfunctions:appfunctions](https://developer.android.com/jetpack/androidx/releases/appfunctions) [View Source](https://cs.android.com/search?q=file:androidx/appfunctions/AppFunctionSchemaDefinition.kt+class:androidx.appfunctions.AppFunctionSchemaDefinition) Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

*** ** * ** ***


```
@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation AppFunctionSchemaDefinition
```

<br />

*** ** * ** ***

Marks an interface as a pre-defined schema for an App Function.

The provided metadata will be stored in AppSearch when indexing App Functions. Agents can then retrieve this metadata as an `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionSchemaMetadata` object by calling `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionManager#observeAppFunctions()`. Agent developers can define and share these annotated App Function schemas as an SDK with app developers.

A pre-defined schema outlines an App Function's capabilities, including its parameters and return type. Knowing the schema in advance allows agents to perform tasks like model fine-tuning for more accurate function calling.

For example, here's how you might define a `findNotes` function schema:

```kotlin
@AppFunctionSchemaDefinition(name = "findNotes", version = 1, category = "Notes")
interface FindNotesSchema {
suspend fun findNotes(
params: FindNotesParams,
): List<Note>
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionSearchSpec` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionSchemaDefinition#AppFunctionSchemaDefinition(kotlin.String,kotlin.Int,kotlin.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, version: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, category: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionSchemaDefinition#category()` The category of the schema. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionSchemaDefinition#name()` The name of the schema. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionSchemaDefinition#version()` The version of the schema. |

## Public constructors

### AppFunctionSchemaDefinition

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
AppFunctionSchemaDefinition(name: String, version: Int, category: String)
```

## Public properties

### category

```
val category: String
```

The category of the schema.

### name

```
val name: String
```

The name of the schema.

### version

```
val version: Int
```

The version of the schema.