FoundationModels.ContextSize
----------------------------

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

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FoundationModels](component_FoundationModels.md) | [16.2](newinversion162.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "FoundationModels.ContextSize"; FoundationModel ) 

**MBS**( **"FoundationModels.ContextSize";** /\* The maximum context size (in tokens) supported by the model. \*/  
**$FoundationModel**) /\* The identifier for the model.e.g. $model \*/ 

### 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 \]  
<small>  
Example result: 4096</small>### See also

- [FoundationModels.Initialize](FoundationModelsInitialize.md)

### Release notes

- **Version 16.2**
    - Added [FoundationModels.ContextSize](https://www.mbsplugins.eu/FoundationModelsContextSize.shtml) and [FoundationModels.TokenCount](https://www.mbsplugins.eu/FoundationModelsTokenCount.shtml) functions for macOS/iOS 26.4.

### Example Databases

- [Mac and iOS/Foundation Models](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Foundation%20Models.shtml#10ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin 16.2 News](https://www.mbsplugins.de/archive/2026-05-20/MBS_FileMaker_Plugin_162_News/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.2pr2](https://www.mbsplugins.de/archive/2026-04-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

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

  
[FoundationModels.CloseSession](FoundationModelsCloseSession.md) - [FoundationModels.GetMaximumResponseTokens](FoundationModelsGetMaximumResponseTokens.md)

[HTML Version](FoundationModelsContextSize.shtml)