***

title: setValidContexts
slug: /reference/typescript/agents/context-builder/step/set-valid-contexts
description: Set which contexts the agent can navigate to from this step.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[ref-step]: /docs/server-sdks/reference/typescript/agents/context-builder/step

Set which contexts the agent can navigate to from this step. Overrides any
context-level `setValidContexts()` for this step.

## **Parameters**

<ParamField path="contexts" type="string[]" required={true} toc={true}>
  List of context names that are reachable from this step.
</ParamField>

## **Returns**

[`Step`][ref-step] -- Self for method chaining.

## **Example**

```typescript {8}
import { ContextBuilder } from '@signalwire/sdk';

const builder = new ContextBuilder();
const ctx = builder.addContext('default');
ctx.addStep('greet').setText('Welcome the caller.');
const step = ctx.addStep('transfer');
step.setText('Transfer the caller to the appropriate department.');
step.setValidContexts(['billing', 'support']);
builder.addContext('billing').addStep('invoice').setText('Help with billing inquiries.');
builder.addContext('support').addStep('help').setText('Help with support issues.');
```