Opened 44 hours ago
Last modified 21 hours ago
#66799 assigned enhancement
Abilities API: Add an open world annotation
| Reported by: | gziolo | Owned by: | gziolo |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.3 |
| Component: | Abilities API | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
WordPress for the Agentic Web outlines a vision for making WordPress capabilities easy to discover and use from the agents people already bring to their sites. To support that vision, ability authors need a standard way to declare whether an ability can interact with public or open-ended entities or stays within a bounded environment.
MCP defines openWorldHint as an optional boolean. If omitted, it defaults to `true`. Clients therefore have no way to distinguish a bounded tool from a potentially open-world tool unless it explicitly declares false.
Core defines readonly, destructive, and idempotent as behavioral annotations, but has no native annotation for this distinction. Adding one lets authors declare the interaction boundary in the ability itself, regardless of how callers access it.
Proposed change
Add open_world as an optional bool|null under meta.annotations in WP_Ability:
true: At least one supported execution path can interact with public or open-ended entities, such as searching the public web or sending data to a caller-supplied destination.false: All supported execution paths stay within a bounded environment, such as the connected account's private catalog. A network call alone does not make an ability open-world.nullor omitted: The ability does not declare this property. Core should keep it unspecified rather than infer either boolean value.
open_world is independent of readonly. A public web search can be both read-only and open-world. Like the existing annotations, it describes behavior and does not change permissions, execution, or exposure.
Core scope and tests
- Document
open_worldalongside the existing annotations and add it to the annotation defaults inWP_Abilitywith a value ofnull. - Test that registration preserves explicit
trueandfalsein ability metadata. Test that omission and explicitnullboth remain unspecified. - Verify that existing abilities without the annotation continue to register and that the annotation does not affect permissions, execution, or exposure.
Change History (9)
This ticket was mentioned in PR #16201 on WordPress/wordpress-develop by @avinashzala01.
43 hours ago
#1
- Keywords has-patch has-unit-tests added
#2
follow-up:
↓ 4
@
43 hours ago
@gziolo
Beyond the ticket's scope list
The REST list controller declares the annotation keys explicitly in two places: the response schema and the annotations collection filter. Both use additionalProperties: true, so open_world would be returned either way, but it would have no description in the schema and would not be a documented filter. I added it there for consistency with readonly, destructive and idempotent. Happy to drop that part if it should be a separate change.
Open questions
- Naming:
open_worldfollows the snake_case ofreadonly, but MCP calls itopenWorldHint. Is the mapping meant to live in an MCP adapter? - Core abilities: should core's own abilities set
open_world => falseexplicitly, as they do fordestructiveandidempotent? I left them untouched. That can be a follow-up if wanted.
Not covered
No dedicated REST test for the new schema entry. It is covered only by the existing abilities tests.
Use of AI tools
- AI assistance: Yes
- Tool: Claude Code
- Used for: Reviewing the existing annotation code, writing the patch and tests, and drafting this comment. I reviewed the changes and checked the test results myself.
#4
in reply to: ↑ 2
@
34 hours ago
Replying to avinashzala01:
- Core abilities: should core's own abilities set
open_world => falseexplicitly, as they do fordestructiveandidempotent? I left them untouched. That can be a follow-up if wanted.
IMO this will need to be considered per-ability and will hinge on how we define "external" sources. I don't think we need answers for this before adding the annotation to the API itself (i.e. not a blocker for this ticket), but I'll share a bit here to seed the conversation going forward.
Guidance
The MCP project has guidance on deciding when to flag hints and how to interpret them in this blog post: https://blog.modelcontextprotocol.io/posts/2026-03-16-tool-annotations/
A key excerpt there re: the open world hint is:
openWorldHintis different. It’s about where the tool reaches and what its output might carry back, which matters after the call as much as before. It’s also the hint most sensitive to deployment context. “External” might mean anything outside a corporate network or anything beyond the local machine, depending on where the server runs. The safest posture is to treat anything a tool considers external as a potential source of untrusted content.
And then later for "example client behavior", the suggestion for openWorldHint is:
Scrutinize output for untrusted content; flag a trust-boundary cross.
WP Context
The handling and enforcement will be the responsibility of consuming clients, but I think the application for our context within WP is to use this flag to mark any process that might touch off-site or user-generated content. When deciding on flags for core abilities, this would include querying or fetching things like comment content, usernames, and possibly media uploads, but might also include fetching certain sets of posts.
Some edge cases that come to mind in trying to define "external" in our context:
- Content generated by authenticated non-admins (editor, author, etc.) which might be fetched in an admin context
- Content or settings that come from plugins that might interact with external APIs
- Results from
core/get-environment-infowhich is external to the WP context - Media queries depending on upload permissions
Any of these might touch data that is considered "external" to the site or it's admins, as opposed to abilities like core/term-create that would be more clearly scoped within WP internals. Taking the MCP implementation as one example, this external data might then be passed to an agent with admin permissions where it carries risk of privilege escalation via prompt injection. This kind of risk also applies in the case of workflows where external data returned from one ability might be passed as input to subsequent abilities.
#5
@
26 hours ago
Replying to nikskyverge:
Thanks for the guidance and the MCP write-up. That settles my question about core abilities: I agree they should be considered one by one, and I'll leave them out of this patch so the annotation can land first.
The first CI run on PR 16201 failed because the generated REST schema fixture (tests/qunit/fixtures/wp-api-generated.js) was missing the new open_world entry. I pushed a fix, which adds only that block, and CI is now green.
Remaining question: open_world vs. MCP's openWorldHint. If the mapping is meant to live in an MCP adapter, the snake_case name looks right as it matches readonly, destructive and idempotent. Please say if you would prefer something else.
@gziolo: since you now own the ticket, do you want to keep the PR as it is, or would you rather change the scope? For example, I can drop the REST schema entries into a separate change, or add the per-ability follow-up for core abilities once the definition of "external" is settled.
#6
@
23 hours ago
@avinashzala01, the mapping from open_world to MCP’s openWorldHint is tracked in https://github.com/WordPress/mcp-adapter/issues/464, so we can keep the snake_case name in Core.
I agree with @nikskyverge that adding the annotation to the API and annotating individual core abilities should be separate steps. Keeping the REST schema and filter entries in this patch also makes sense for consistency with the existing annotations.
MCP defaults to true when openWorldHint is omitted. Core should preserve an unspecified value, and we should explicitly set meta.annotations.open_world to false only when all supported execution paths meet the bounded-environment criteria we establish for WordPress. We can continue discussing those criteria without blocking this API addition.
To add to the considerations raised, embeds in post content are another case worth examining, particularly when an ability resolves or returns third-party content. We should also distinguish WordPress’s existing content sanitization from protection against prompt injection: content can be safe to render and still contain instructions intended to influence an agent. Neither sanitization nor an open_world: false annotation should be treated as a guarantee that returned content is trusted.
@gziolo commented on PR #16201:
23 hours ago
#7
Thanks for working on this, @avinash-addweb! The change looks good and is almost ready. I have some feedback to share.
In the places where the new annotation is documented, please add a @since entry. We did the same when meta.public was added, for example @since 7.1.0 Added the public meta argument.
I think we can spend some time trying to iron out the description. The phrase "public or open-ended entities" is hard to follow. The word "public" is also used by the public meta key, which has a different meaning. Would you like to try a different wording? One idea is to say that when the value is true, the ability may interact with systems outside of the site, such as remote HTTP services or email recipients. When the value is false, the ability only interacts with the site itself. Feel free to propose something else. It would be good to use the same wording in all places.
Could you also add a test for the REST API? Query parameters arrive as strings, so it would be good to check that meta[annotations][open_world]=true is treated as a boolean. The existing test_filter_by_annotation test does this for readonly, so you can follow its structure.
#8
@
21 hours ago
Thanks for the review, @gziolo. Pushed abc4456g with the changes:
- Added
@since 7.3.0entries wherever the annotation is documented. - Reworded the description using your suggestion (systems outside of the site, such as remote HTTP services or email recipients; false means the ability only interacts with the site itself), with the same wording in the docblocks, the code comment, the REST schema and the generated fixture.
- Added
test_filter_by_open_world_annotation, followingtest_filter_by_annotation. It passes'true'and'false'as strings and checks they are coerced to booleans, and that an ability without the annotation matches neither.
I used 7.3.0 for @since to match the milestone. Let me know if you would prefer a different version.
What
Adds
open_worldas an optionalbool|nullannotation undermeta.annotations, next toreadonly,destructiveandidempotent.true: at least one supported execution path can interact with public or open-ended entities.false: all supported execution paths stay within a bounded environment.nullor omitted: not declared. Core does not infer a value.Like the other annotations it is a hint. It does not change permissions, execution or exposure.
Changes
WP_Ability::$default_annotationsgetsopen_world => null.annotationsdocblocks inabilities-api.php,WP_Abilities_RegistryandWP_Abilitydocument the new key.WP_REST_Abilities_V1_List_Controllerdeclaresopen_worldin the response schema and in theannotationscollection filter, as it already does for the other three.Core's own abilities are not changed. They can opt in separately.
Testing
test_open_world_annotationcovers explicittrue,falseandnull, and omission.npm run test:php -- --group abilities-apipasses on single site (940 tests) and multisite (945).