[5.x] MCP: `configuration.update` fails for Matrix fields with TypeError on `$propagationMethod`
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- php
調査の方向性
Start in craft\mcp\capabilities\Fields::update() and trace how field settings reach Craft::configure(), comparing that path with Matrix field construction and its propagationMethod normalization. Reproduce with the craft shell commands in the report, then check the MCP update and error handling paths. Done when Matrix settings updates save successfully and failures return useful error details; the separate stdio config lock observation may need follow-up.
索引モデルが issue の本文から書いたものです。
説明
What happened?
Description
Updating the settings of a Matrix field via the MCP tool configuration.update (type fields) always fails. The MCP client only receives the generic error Error while executing tool. The console log only contains [mcp] Unhandled error during tool execution, without the exception.
Running the same steps as craft\mcp\capabilities\Fields::update() in craft shell shows the underlying exception:
TypeError: Cannot assign string to property craft\fields\Matrix::$propagationMethod of type craft\enums\PropagationMethod
Cause: Fields::update() builds the new attributes from the current settings:
$attributes = [...array_replace($field->getSettings(), $this->sensitiveValues->restore($settings, $field->getSettings())), ...$attributes];
Craft::configure($field, $attributes);
$field->getSettings() returns propagationMethod as the string 'all'. Craft::configure() then assigns that string directly to the typed property Matrix::$propagationMethod (PropagationMethod enum). This bypasses the normalization the Matrix constructor normally does. So any settings update on any Matrix
field fails, whatever settings are supplied. Creating a Matrix field via configuration.create works fine.
Steps to reproduce
- Have a Matrix field, e.g. handle
components, withallowAdminChangesenabled. - Start the MCP server:
php craft mcp/serve --user=admin. - Call
configuration.update:{ "type": "fields", "identifier": { "handle": "components" }, "attributes": { "settings": { "entryTypes": [ { "uid": "<existing entry type uid>" }, { "uid": "<new entry type uid>" } ] } } } - The tool returns
Error while executing tool. Supplying noentryTypesand only another setting (e.g.maxEntries) fails the same way.
To see the exception directly, run in php craft shell:
$field = Craft::$app->getFields()->getFieldByHandle('components');
get_debug_type($field->getSettings()['propagationMethod']); // "string"
Craft::configure($field, $field->getSettings()); // TypeError
Expected behavior
The supplied settings are merged into the Matrix field and the field is saved, e.g. the new entry type is added. If something fails, the MCP response includes the actual error message.
Actual behavior
- The update fails with a
TypeErroronMatrix::$propagationMethodbefore anything is saved. - The MCP client only gets
Error while executing tool, and the log entry has no exception details. This makes the cause very hard to find.
Additional observation (stdio server)
Possibly related: with mcp/serve (stdio), after the first successful project config change (e.g. configuration.create), the long-running process seems to keep the project config lock. The project config is also not flushed to the projectconfig table, because the request never ends. Afterwards:
- other
craftCLI commands fail withcraft\errors\BusyResourceException: A lock could not be acquired to modify the project config. - YAML is only written after calling
project-config.write, and the stored config stays out of sync until the MCP process is restarted andproject-config/applyruns.
Happy to open a separate issue for this if preferred.
Craft CMS version
5.12.0.1
PHP version
8.4.27
Operating system and version
macOS 27.0.1
Database type and version
MySQL 8.0.33
Image driver and version
No response
Installed plugins and versions
No response
- 主要言語
- 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 日以内に返信
-
[5.x]: MCP returns `[]` for CKEditor field values対応中かも @i-just が 1 日前に担当しました。 オープンrepo:cms
craftcms/cms#20404 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[6.x]: Entry edit page takes ~0.4s longer to first paint for every Matrix block対応中かも @riasvdv が 2 日前に担当しました。 オープン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 が 2 日前に担当しました。 オープンbug
craftcms/cms#20388 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
shukiv/jabali-panel#2423 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
customer-reported enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
MagnaCapax/PMSS#1252 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 79/100
smarty-php/smarty#1220 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
StarCitizenWiki/mediawiki-extensions-EmbedVideo#224 · コメント 1 件 ·