aiida_mcp.limits module¶
Shared handling for tool limit arguments.
- aiida_mcp.limits.clamp_limit(value: int | None, default: int, maximum: int) int¶
Clamp a requested limit to [1, maximum], falling back to default when None.
- Parameters:
value (int or None) – The requested limit, or None to use the default.
default (int) – The value to use when value is None.
maximum (int) – The upper bound to clamp value to.
- Returns:
The clamped limit.
- Return type:
int
- Raises:
ToolError – If value is less than 1.