FoundationModels.GetMaximumResponseTokens
-----------------------------------------

Queries the maximum number of tokens the model is allowed to produce in its response.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FoundationModels](component_FoundationModels.md) | [15.5](newinversion155.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "FoundationModels.GetMaximumResponseTokens"; FoundationModel ) 

**MBS**( **"FoundationModels.GetMaximumResponseTokens";** /\* Queries the maximum number of tokens the model is allowed to produce in its response. \*/  
**$FoundationModel**) /\* The identifier for the model.e.g. $model \*/ 

### Parameters

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

### Result

Returns number, nothing or error.

### Description

Queries the maximum number of tokens the model is allowed to produce in its response.  
If the model produce `maximumResponseTokens` before it naturally completes its response, the response will be terminated early. No error will be thrown. This property can be used to protect against unexpectedly verbose responses and runaway generations.  
  
If no value is specified, then the model is allowed to produce the longest answer its context size supports. If the response exceeds that limit without terminating, an error will be thrown.  
  
Returns empty value if not set.  
### Examples

Queries maximum response tokens:

 Set Variable \[ $MaximumResponseTokens ; Value: MBS ( "FoundationModels.GetMaximumResponseTokens" ) \]  
### See also

- [FoundationModels.SetMaximumResponseTokens](FoundationModelsSetMaximumResponseTokens.md)

### Blog Entries

- [New in MBS FileMaker Plugin 15.5](https://www.mbsplugins.de/archive/2025-11-25/New_in_MBS_FileMaker_Plugin_15/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 26th September 2025 , last changed 27th September 2025

  
[FoundationModels.ContextSize](FoundationModelsContextSize.md) - [FoundationModels.GetTemperature](FoundationModelsGetTemperature.md)

[HTML Version](FoundationModelsGetMaximumResponseTokens.shtml)