Skip to content

Add meta.mcp.public to the media and terms abilities for MCP exposure - #12

Merged
nikmclaughlin merged 1 commit into
mainfrom
add/mcp-public-meta
Nov 10, 2026
Merged

nikmclaughlin merged 1 commit into
mainfrom
add/mcp-public-meta

Conversation

@nikmclaughlin

@nikmclaughlin nikmclaughlin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What?

Adds 'mcp' => array( 'public' => true ) to the ability_meta() of the 8 media and terms abilities — wp/media-query, wp/media-upload, wp/media-update, wp/media-delete, wp/terms-query, wp/term-create, wp/term-update, wp/term-delete.

Why?

These abilities carry annotations + show_in_rest meta only — no high-level public flag — so MCP consumers that resolve exposure via meta.public alone would never surface them. The MCP adapter's McpAbilityExposure checks meta.mcp.public first (falling back to meta.public), which lets these abilities opt in to the MCP surface without changing their high-level publicness (deliberately — see the open question below).

This PR is one half of the PoC pair proving consumer #1 (the MCP adapter) consuming this package end to end (PoC plan, step 1.5); the adapter PoC pins this branch so all 18 abilities are testable.

How?

  • The 8 ability_meta() arrays gain the mcp key appended after show_in_rest (additive, line-preserving); annotations and show_in_rest untouched; no other abilities touched.
  • Tests: no exact-meta assertions existed for these abilities, so this PR adds guard assertions pinning the new mcp exact shape and that high-level public is unchanged, exercised on both wp-env environments (expansion only — zero assertion deletions).

Open question for the team (why this PR is deliberately open, not merged)

meta.mcp.public (this PR) vs. promoting the 8 abilities to full meta.public — which semantic should the package carry? The MCP-specific flag preserves the abilities' high-level non-public status (upstream-faithful to the WordPress/ai ports); full public is simpler but changes more than the MCP use case needs. The team decides; the adapter PoC works with either resolution.

Follow-up noted (not blocking)

The Registrar's public_only docblock calls it "the MCP-tool use case," but the probe checks only meta.public — the two layers' semantics should stay consistent (extend the probe to honor meta.mcp.public, or reword the docblock). Tracked for a follow-up issue.

Use of AI tools

Tool(s): goose (agent). Model(s): glm-5.3-flash:cloud via the harness. Used for: implementation, tests, and this description's drafting basis (plan-driven per PLAN-mcp-adapter-poc §1/§4.0/§7.3). Reviewed and edited by the committer.

Testing Instructions

  1. composer run lint:phpcs && composer run lint:phpstan && composer run verify:manifest && composer run verify:coreify — all clean.
  2. PHPUnit on both wp-env environments (trunk + latest stable, one at a time): the new mcp exact-shape and public-unchanged assertions pass alongside the full suite (one pre-existing upstream-faithful cast warning, unchanged by this diff).

PLAN-mcp-adapter-poc.md step 1.5 (sec. 1 resolution, sec. 4.0): the 8 media/terms
abilities — wp/media-query, wp/media-upload, wp/media-update, wp/media-delete,
wp/terms-query, wp/term-create, wp/term-update, wp/term-delete — did not carry
the public meta, so the MCP adapter's McpAbilityExposure falls back to
meta.public and excludes them from the MCP surface. This adds the MCP-specific
flag mcp => array( public => true ) to their ability_meta(), which
McpAbilityExposure checks first, without changing their high-level publicness
(no public key added) — the team decides between the mcp flag and full
meta.public before this lands on the package's main.

annotations/show_in_rest and every other meta key are untouched; no other
ability changes. The Registrar's Gate-6 public_only probe reads the ability's
own public meta only — the flag is additive there.

Tests: the registered-once tests of the 8 abilities (media-query/upload/
update/delete, terms-query, and the term-writes contract test) each now also
assert the exact mcp meta shape ( array( public => true ) ) and that the
high-level public meta is unchanged (get_meta_item( 'public', false ) ===
false). No assertions were deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant