# 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])
public 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/androidx/appfunctions/metadata/AppFunctionSchemaMetadata` object by calling `https://developer.android.com/reference/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:

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

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

## Summary

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionSchemaDefinition#getCategory()()` The category of the schema. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionSchemaDefinition#getName()()` The name of the schema. |
| `final int` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionSchemaDefinition#getVersion()()` The version of the schema. |

## Public methods

### getCategory

```
public final @NonNull String getCategory()
```

The category of the schema.

### getName

```
public final @NonNull String getName()
```

The name of the schema.

### getVersion

```
public final int getVersion()
```

The version of the schema.