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

# setValidContexts

> Set which contexts the agent can navigate to from this context.

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

Set which contexts the agent can navigate to from this context. Acts as a
context-level default; step-level `setValidContexts()` can further restrict or
expand navigation for individual steps.

## **Parameters**

**`contexts`** `string[]` — required

List of context names that are reachable from this context.

---

## **Returns**

[`Context`][ref-context] -- Self for method chaining.

## **Example**

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

const builder = new ContextBuilder();
const main = builder.addContext('default');
main.addStep('greet').setText('Welcome the caller.');
const support = builder.addContext('support');
support.setValidContexts(['default', 'billing']);
support.addStep('help').setText('Help the caller with their issue.');
const billing = builder.addContext('billing');
billing.addStep('invoice').setText('Help with billing inquiries.');
```