[5.x]: MCP returns `[]` for CKEditor field values
Los mantenedores suelen responder en 1 día
@i-just ya está trabajando en esto.
Desde el 6/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
What happened?
MCP can write CKEditor fields but can't read them back. The HTML saves to the database, but every read returns [] or leaves the field out. This happens in elements_get, elements_list, revisions, and the public craft_query tool. So an agent can't proofread or summarize rich text, and it can't check its own writes.
I think the cause is in src/mcp/serializers/ElementSerializer.php. The CKEditor field implements ElementContainerFieldInterface because it can hold Nested Entries, and the serializer treats every field with that interface as a list of nested elements:
- Line 75: with
fields: null, the field is skipped as a nested field. - Line 79: with
fields: ["body"], it goes tonestedValue(). The value is acraft\ckeditor\data\FieldDataobject, not an element, query, or collection, so it falls through todefault => [].
Should CKEditor fields go through $field->serializeValue() here, with Nested Entries added separately? The 6.x serializer has the same check.
Steps to reproduce
- Install CKEditor 5.9.0 and add a CKEditor field
bodyto an Entry Type. No Nested Entry Types. - Create an Entry with
bodyset to<p>Hello</p>. - Call
elements_getwith{"type": "entry", "id": <id>, "fields": ["body"]}. - Call
elements_getwith{"type": "entry", "id": <id>, "fields": null}. - Call
elements_updatewith{"type": "entry", "id": <id>, "fields": {"body": "<p>Changed</p>"}}, then repeat step 3.
Expected behavior
body returns the HTML ("<p>Hello</p>") for both fields: ["body"] and fields: null.
Actual behavior
- Step 3 returns
"body": []. - Step 4 has no
bodykey. - Step 5 saves
<p>Changed</p>toelements_sites.content, but the read still returns[].
It's the same when body is inside a Matrix Block. The blocks come back with only a title. On the public server, that means a chatbot can't read article text even when the Section is approved.
Craft CMS version
5.12.0.1, and 5.x-dev (3419773)
PHP version
8.4.20
Operating system and version
DDEV 1.25.2 on macOS
Database type and version
MySQL 8.0.40
Installed plugins and versions
- CKEditor 5.9.0
- Lenguaje dominante
- PHP
- Estrellas
- 3.6k
- Forks
- 712
- Merge medio
- 13 h 13 min
- PR fusionados (30 d)
- 372
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de craftcms/cms
-
bug repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
craftcms/cms#20205 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[6.x]: Element index View menu: sort direction buttons only update after the table has loadedAbiertobug repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
craftcms/cms#20203 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[6.x]: Entry edit page takes ~0.4s longer to first paint for every Matrix blockPosiblemente ocupada @riasvdv la tomó hace 1 día. Abiertobug repo:cms
craftcms/cms#20401 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[6.x]: Custom entry source with a single-section condition shows another source's entriesPosiblemente ocupada @brandonkelly la tomó hace 1 día. Abiertobug
craftcms/cms#20388 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[6.x]: settings icon not rending with admin changes disabledPosiblemente ocupada @brandonkelly la tomó hace 2 días. Abiertobug repo:cms
craftcms/cms#20338 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de craftcms/cms
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Automattic/blocks-engine#4874 ·
Los mantenedores suelen responder en 1 día
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
endoflife-date/endoflife.date#11561 ·
Los mantenedores suelen responder en 1 día
-
area:php-extension priority:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
crazy-goat/go-mesi#623 ·
Los mantenedores suelen responder en 1 día
-
good first issue priority:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
crazy-goat/fdb-php#184 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nextcloud/groupfolders#5218 ·
Los mantenedores suelen responder en 1 día