Skip to content

CustomFieldSchema ​

Type
Class
Namespace
craft\mcp\schema
Inherits
craft\mcp\schema\CustomFieldSchema
Since
5.12.0

View source

Public Methods ​

MethodDescription
__construct()
forElement()
prepareValues()Validates custom field values against the schema {@see forElement()} describes, and converts them into the format the fields accept.

__construct() ​

View source

Arguments ​

  • $schemaValidator

forElement() ​

View source

Arguments ​

  • $element

Returns ​

array<string,mixed>

prepareValues() ​

Validates custom field values against the schema {@see forElement()} describes, and converts them into the format the fields accept.

Schemas inferred from a field's GraphQL mutation argument type describe GraphQL input, such as Matrix entries keyed by entry type handle, so their values go through the same normalizers the GraphQL API applies.

View source

Arguments ​

  • $element
  • $values (array<string,mixed>)

Returns ​

array<string,mixed>

Throws ​

  • \Mcp\Exception\ToolCallException
    if the values don’t match the schema.