getContext

View as MarkdownOpen in Claude

Retrieve an existing context by name for inspection or modification.

Parameters

name
stringRequired

Name of the context to retrieve.

Returns

Context if found, undefined otherwise.

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5ctx.addStep('greet').setText('Greet the caller.');
6
7const retrieved = builder.getContext('default');
8if (retrieved !== undefined) {
9 retrieved.addStep('followup').setText('Ask if there is anything else.');
10}