Skip to content

Feature Gating

Pedro de Carvalho edited this page Jul 29, 2026 · 1 revision

Feature Gating

Saltus Framework allows fine-grained control over which features are exposed via REST API routes and MCP/Abilities tools. This is managed through model-level options and per-feature configuration in the config array.

Master Options (Model Level)

Two master options in the options array control access:

Option Type Default Description
show_in_rest bool true Controls whether model-scoped REST routes are registered. If explicitly set to false, all model-scoped REST capabilities are disabled.
mcp_tools bool false Must be set and truthy to enable any MCP tools for that model.

The framework-scoped health capability (get_health) is independent of per-model opt-in and is always available.

Example

return [
    'type'    => 'cpt',
    'name'    => 'book',
    'options' => [
        'show_in_rest' => true,
        'mcp_tools'    => true,
    ],
];

Per-Feature Gating (config)

Each individual capability can be gated independently in the model's config array:

Feature Config Key Location
Meta meta Root level of config
Settings settings Root level of config
Duplicate duplicate Nested under config.features
Single Export single_export Nested under config.features
Drag & Drop drag_and_drop Nested under config.features

Resolution Rules

For each feature configuration section:

  1. Omitted (Null): Falls back to the master model option. If the master option is omitted or false, the feature is disabled. If the master option is true, the feature is enabled.

  2. Boolean Value: A simple boolean acts as a joint gate. false disables both REST and MCP. true enables both.

  3. Array Value: REST and MCP can be configured independently:

    • show_in_rest — governs REST route availability. Falls back to master show_in_rest if omitted.
    • show_in_mcp — governs MCP tool availability. Falls back to master mcp_tools if omitted.

Examples

return [
    'type'    => 'cpt',
    'name'    => 'book',
    'options' => [
        'show_in_rest' => true,
        'mcp_tools'    => true,
    ],
    'config'  => [
        // Array style: enabled for REST but disabled for MCP
        'meta'     => [
            'show_in_rest' => true,
            'show_in_mcp'  => false,
        ],
        // Boolean style: disabled for both REST and MCP
        'settings' => false,

        'features' => [
            // Array style: enabled for REST, defaults to master (enabled) for MCP
            'duplicate' => [
                'show_in_rest' => true,
            ],
            // Omitted: both single_export and drag_and_drop
            // default to matching the master options (enabled)
        ],
    ],
];

If show_in_rest is explicitly false, Saltus does not register the model-scoped REST routes. The mcp_tools option controls whether MCP tools are exposed.

Clone this wiki locally