# action

Package: `@threadplane/angular/chat` · 0.3.7

Reference: /docs/api/angular/chat/action

```typescript
import { action } from '@threadplane/angular/chat';
```

## action · overload 1

Declare an async function tool the model can call; its resolved return value
becomes the tool result shipped back to the model.

```typescript
export declare function action<S extends StandardSchemaV1, R>(description: string, schema: S, handler: (args: StandardSchemaInferOutput<S>, context: FunctionToolHandlerContext) => R | Promise<R>, options?: ClientToolExecutionOptions): FunctionToolDef<S, R>;
```

- **description**: Natural-language description the model sees.

- **schema**: Standard Schema (e.g. a Zod object) for the arguments; the
 handler's argument type is inferred from it.

- **handler**: Runs in the browser when the model calls the tool. The second
 argument carries an `AbortSignal`; its return type `R` is carried on the
 resulting [FunctionToolDef](/docs/api/angular/chat/FunctionToolDef).

- **options**: Execution policy options, including `idempotent: true` to skip
 durable pre-execution claims when a guard is configured.

**Returns:** A [FunctionToolDef](/docs/api/angular/chat/FunctionToolDef) for inclusion in [tools](/docs/api/angular/chat/tools).

```ts
const move = action('Move a stop', z.object({ fromDay: z.number() }), (a) => a.fromDay);
const registry = tools({ move_stop: move });
```