slonline / jsonfield
JSON MySQL DB Field - Module for SilverStripe 6
6.1.0
2026-10-09 09:36 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ^11.3
- slonline/silverstripe-mcp: ^6.x-dev
Suggests
- slonline/silverstripe-mcp: Lets AI agents (MCP) read and write JSON fields, optionally validated by a JSON Schema
Provides
None
Conflicts
None
Replaces
None
README
Requirements
- silverstripe/framework ~6.0
Installation
- Add the following code to the
requirekey incomposer.jsonfile:
composer require slonline/jsonfield
Usage
Datatype
$db = [
...
'MyJSON' => DBJSONText::class,
];
AI agents (MCP)
With slonline/silverstripe-mcp installed, AI agents can read
and write DBJSONText fields as JSON values (objects, lists, strings, numbers, …); null clears the field.
Describe the expected structure with a JSON Schema so the agent knows what to write. Writes that do not match the schema are rejected with the path of the first error:
private static array $mcp_json_schemas = [ 'OpeningHours' => [ 'type' => 'object', 'description' => 'Opening hours per weekday', 'properties' => [ 'days' => [ 'type' => 'array', 'items' => [ 'type' => 'object', 'properties' => [ 'day' => ['type' => 'string', 'enum' => ['mon', 'tue', 'wed', 'thu', 'fri']], 'from' => ['type' => 'string', 'pattern' => '^\\d{2}:\\d{2}$'], ], 'required' => ['day', 'from'], ], ], ], 'required' => ['days'], ], ];
Without a schema any JSON value is accepted.