# FunctionSchema


```
public final class FunctionSchema
```

<br />

*** ** * ** ***

Defines the schema of parameters or responses for a tool.

## Summary

| ### Public constructors |
|---|
| `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#FunctionSchema(kotlin.Int,kotlin.String,kotlin.collections.Map,kotlin.collections.List,kotlin.collections.List,kotlin.String,kotlin.Boolean,com.google.mlkit.genai.schema.tools.FunctionSchema,kotlin.Long,kotlin.Long,kotlin.Double,kotlin.Double,kotlin.Long,kotlin.Long,kotlin.String,kotlin.collections.List,kotlin.String,kotlin.Long,kotlin.Long)( @https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType int type, https://developer.android.com/reference/java/lang/String.html description, https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema> properties, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html> required, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html> enum, https://developer.android.com/reference/java/lang/String.html format, https://developer.android.com/reference/java/lang/Boolean.html nullable, https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema items, https://developer.android.com/reference/java/lang/Long.html minItems, https://developer.android.com/reference/java/lang/Long.html maxItems, https://developer.android.com/reference/java/lang/Double.html minimum, https://developer.android.com/reference/java/lang/Double.html maximum, https://developer.android.com/reference/java/lang/Long.html minLength, https://developer.android.com/reference/java/lang/Long.html maxLength, https://developer.android.com/reference/java/lang/String.html pattern, https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema> anyOf, https://developer.android.com/reference/java/lang/String.html title, https://developer.android.com/reference/java/lang/Long.html minProperties, https://developer.android.com/reference/java/lang/Long.html maxProperties )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getAnyOf()()` optional list of subschemas that the value must validate against at least one of |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getDescription()()` optional human-readable description of the schema used by the model |
| `final https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getEnum()()` optional list of allowed values for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` or numeric types |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getFormat()()` optional format of the data type (e.g., "float", "double", "int32", "int64") |
| `final https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getItems()()` optional schema of items in an array for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMaxItems()()` optional maximum number of items for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMaxLength()()` optional maximum length for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` type |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMaxProperties()()` optional maximum number of properties for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type |
| `final https://developer.android.com/reference/java/lang/Double.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMaximum()()` optional maximum value for numeric types |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMinItems()()` optional minimum number of items for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMinLength()()` optional minimum length for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` type |
| `final https://developer.android.com/reference/java/lang/Long.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMinProperties()()` optional minimum number of properties for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type |
| `final https://developer.android.com/reference/java/lang/Double.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getMinimum()()` optional minimum value for numeric types |
| `final https://developer.android.com/reference/java/lang/Boolean.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getNullable()()` optional boolean indicating whether the value may be null |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getPattern()()` optional regex pattern that string values must match |
| `final https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getProperties()()` optional map of property names to their respective `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema` definitions for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type |
| `final https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getRequired()()` optional list of property names that must be present for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getTitle()()` optional title for the schema |
| `final int` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#getType()()` the data type of the schema, must be one of the constants defined in `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType` |
| `int` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema#toString()()` |

## Public constructors

### FunctionSchema

```
public FunctionSchema(
    @FunctionType int type,
    String description,
    Map<@NonNull String, @NonNull FunctionSchema> properties,
    List<@NonNull String> required,
    List<@NonNull String> enum,
    String format,
    Boolean nullable,
    FunctionSchema items,
    Long minItems,
    Long maxItems,
    Double minimum,
    Double maximum,
    Long minLength,
    Long maxLength,
    String pattern,
    List<@NonNull FunctionSchema> anyOf,
    String title,
    Long minProperties,
    Long maxProperties
)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getAnyOf

```
public final List<@NonNull FunctionSchema> getAnyOf()
```

optional list of subschemas that the value must validate against at least one of

### getDescription

```
public final String getDescription()
```

optional human-readable description of the schema used by the model

### getEnum

```
public final List<@NonNull String> getEnum()
```

optional list of allowed values for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` or numeric types

### getFormat

```
public final String getFormat()
```

optional format of the data type (e.g., "float", "double", "int32", "int64")

### getItems

```
public final FunctionSchema getItems()
```

optional schema of items in an array for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type

### getMaxItems

```
public final Long getMaxItems()
```

optional maximum number of items for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type

### getMaxLength

```
public final Long getMaxLength()
```

optional maximum length for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` type

### getMaxProperties

```
public final Long getMaxProperties()
```

optional maximum number of properties for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type

### getMaximum

```
public final Double getMaximum()
```

optional maximum value for numeric types

### getMinItems

```
public final Long getMinItems()
```

optional minimum number of items for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#ARRAY()` type

### getMinLength

```
public final Long getMinLength()
```

optional minimum length for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#STRING()` type

### getMinProperties

```
public final Long getMinProperties()
```

optional minimum number of properties for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type

### getMinimum

```
public final Double getMinimum()
```

optional minimum value for numeric types

### getNullable

```
public final Boolean getNullable()
```

optional boolean indicating whether the value may be null

### getPattern

```
public final String getPattern()
```

optional regex pattern that string values must match

### getProperties

```
public final Map<@NonNull String, @NonNull FunctionSchema> getProperties()
```

optional map of property names to their respective `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionSchema` definitions for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type

### getRequired

```
public final List<@NonNull String> getRequired()
```

optional list of property names that must be present for `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType#OBJECT()` type

### getTitle

```
public final String getTitle()
```

optional title for the schema

### getType

```
public final int getType()
```

the data type of the schema, must be one of the constants defined in `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/tools/FunctionType`

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```