assistant-ui logo/Docs/API Reference
Model Context

Model Context Registry

Register and manage assistant-ui model context providers that contribute instructions and app state.

API Reference

ModelContextRegistry

ModelContextRegistry
getModelContext ?: () => ModelContext

subscribe ?: (callback: () => void) => Unsubscribe

addTool ?: (tool: AssistantToolProps<TArgs, TResult>) => ModelContextRegistryToolHandle<TArgs, TResult>

addInstruction ?: (config: string | AssistantInstructionsConfig) => ModelContextRegistryInstructionHandle

addProvider ?: (provider: ModelContextProvider) => ModelContextRegistryProviderHandle