Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

FoundationModels.ContextSize

The maximum context size (in tokens) supported by the model.

Component Version macOS Windows Linux Server iOS SDK
FoundationModels 16.2 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "FoundationModels.ContextSize"; FoundationModel )   More

Parameters

Parameter Description Example
FoundationModel The identifier for the model. $model

Result

Returns number or error.

Description

The maximum context size (in tokens) supported by the model.
This is new in macOS/iOS 26.4.

The context size represents the total number of tokens that can be used in a single session, including both input prompts and generated responses.

Returns an error if the context size cannot be determined. Typically this is due to the model not being available or Apple Intelligence is disabled.

Examples

Query context size:

Set Variable [ $Size ; Value: MBS("FoundationModels.ContextSize"; $$session) ]
Show Custom Dialog [ "Maximum Context Size" ; $size ]

Example result: 4096

See also

Release notes

Example Databases

Blog Entries

This function is free to use.

Created 10th April 2026, last changed 11st April 2026


FoundationModels.CloseSession - FoundationModels.GetMaximumResponseTokens