fix(resources): mirror annotations into meta.mcp to silence 0.5.0 deprecation - #31
Merged
Merged
Conversation
…recation
mcp-adapter 0.5.0 resolves resource meta through get_mcp_meta(), which
prefers meta.mcp.{key} and logs a deprecation notice when it falls back to
the top-level key. #29/#30 moved uri/mimeType into meta.mcp but left
annotations at the top level, so every WP-CLI run logged four notices:
Ability meta key "annotations" is deprecated. Use "mcp.annotations"
instead. | Context: {"ability":"gds/block-types-list", ...}
Mirror annotations into meta.mcp for the four resource abilities. The
top-level copy stays: RegisterAbilityAsMcpTool still reads only
$ability_meta['annotations'] in 0.5.0, and adapters < 0.5.0 read top-level
for resources too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every WP-CLI run against a site with mcp-adapter 0.5.0 logs four deprecation notices:
mcp-adapter 0.5.0 resolves resource meta through
get_mcp_meta()(Domain/Resources/RegisterAbilityAsMcpResource.php:299), which prefersmeta.mcp.{key}and logs a deprecation when it falls back to the top-level key. #29/#30 moveduri/mimeTypeintometa.mcpbut leftannotationsat the top level.Only these four abilities warn because tools go through a different path (
RegisterAbilityAsMcpTool.php:143) that still reads top-levelmeta.annotationsand does not deprecate it.Note the notice is unavoidable by deletion: WP core always populates top-level
meta.annotationswith defaults (class-wp-ability.php:333), so the deprecated branch is permanently reachable. Providing a validmcp.annotationsthat wins the lookup is the only way to silence it.Change
Mirror
annotationsintometa.mcpfor the four resource abilities:BlockCatalogResource,SiteMapResource,ThemeJsonResource,AcfFieldsResource.The top-level copy is retained deliberately — it is load-bearing, not legacy cruft:
$ability_meta['annotations'], on 0.5.0 and on trunk today. There is nomcp.annotationssupport on the tool path at all.Removing it would silently drop annotations from every tool ability. Comments in each file now say so.
Backwards compatibility
Verified against the actual sources:
$ability_meta['annotations']only$ability_meta['annotations']onlymcp.annotations→ top-level fallback + deprecationNothing rejects the extra key: every
meta['mcp']consumer in the adapter (all versions incl. trunk) is a targeted??lookup on a named key (public,type,uri,mimeType,icons,_meta) — no unknown-key validation. WP core validates only thatmetais an array, top-levelmeta.annotationsis an array, andshow_in_restis a bool.SchemaValidationTest::test_all_abilities_have_annotationsasserts top-levelannotationsexists — still satisfied.Verification
composer lint→ passcomposer stan→ no errorswp cache flush→ clean output, zero deprecation noticesmcp-adapter-discover-abilitiesstill returns the full ability list🤖 Generated with Claude Code