[5.x]: MCP returns `[]` for CKEditor field values
メンテナーはふだん 1 日以内に返信
@i-just がすでに取り組んでいます。
2026年11月6日 から。
評価
この issue はまだ評価されていません。
説明
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
- 主要言語
- PHP
- スター
- 3.6k
- フォーク
- 712
- 平均マージ
- 13時間 13分
- マージ済み PR(30日)
- 372
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
craftcms/cms のほかの issue
-
bug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
craftcms/cms#20205 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
craftcms/cms#20203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[6.x]: Entry edit page takes ~0.4s longer to first paint for every Matrix block対応中かも @riasvdv が 1 日前に担当しました。 オープンbug repo:cms
craftcms/cms#20401 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[6.x]: Custom entry source with a single-section condition shows another source's entries対応中かも @brandonkelly が 1 日前に担当しました。 オープンbug
craftcms/cms#20388 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[6.x]: settings icon not rending with admin changes disabled対応中かも @brandonkelly が 2 日前に担当しました。 オープンbug repo:cms
craftcms/cms#20338 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Automattic/blocks-engine#4874 ·
メンテナーはふだん 1 日以内に返信
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
endoflife-date/endoflife.date#11561 ·
メンテナーはふだん 1 日以内に返信
-
area:php-extension priority:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
crazy-goat/go-mesi#623 ·
メンテナーはふだん 1 日以内に返信
-
good first issue priority:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
crazy-goat/fdb-php#184 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nextcloud/groupfolders#5218 ·
メンテナーはふだん 1 日以内に返信