|
| 1 | +# Ability Architecture |
| 2 | + |
| 3 | +`WP_Forge\Abilities` is the coordinator for the WordPress MCP ability catalog. It owns the registry, public listing/schema APIs, WordPress Abilities API registration, tool-name conversion, and dispatch through `call()`. |
| 4 | + |
| 5 | +`src/Tools/` is reserved for ability registration traits. Registration traits define tool schemas, labels, descriptions, annotations, capabilities, and callbacks. |
| 6 | + |
| 7 | +Shared coordinator behavior lives in `src/Ability/Concerns/`: |
| 8 | + |
| 9 | +| File | Responsibility | |
| 10 | +| --- | --- | |
| 11 | +| `Concerns/SchemaHelpers.php` | JSON schema builders, runtime enum lookup helpers, response schema, annotation mapping, and small shared normalizers. | |
| 12 | +| `Concerns/Permissions.php` | Static and dynamic permission checks for ability calls. | |
| 13 | +| `Concerns/Validation.php` | Runtime validation for post types, content constraints, MIME types, user roles, and post type metadata. | |
| 14 | + |
| 15 | +Domain behavior lives in `src/Ability/Domains/`: |
| 16 | + |
| 17 | +| Registration trait | Domain trait | |
| 18 | +| --- | --- | |
| 19 | +| `Tools/ContentManagementTools.php` | `Domains/Content.php` | |
| 20 | +| `Tools/TaxonomyTools.php` | `Domains/TaxonomyTerms.php` | |
| 21 | +| `Tools/MediaTools.php` | `Domains/Media.php` | |
| 22 | +| `Tools/SiteManagementTools.php` | `Domains/Users.php` and `Domains/Site.php` | |
| 23 | +| `Tools/GlobalStylesTools.php` | `Domains/GlobalStyles.php` | |
| 24 | +| `Tools/RestCatalogTools.php` | `Domains/RestExecution.php` | |
| 25 | + |
| 26 | +When adding a tool, keep registration in the existing `src/Tools/*Tools.php` trait and put runtime behavior in the matching `src/Ability/Domains/` trait. If the tool needs shared schema, validation, or permission behavior, prefer `src/Ability/Concerns/` instead of adding more private implementation methods to `Abilities`. |
| 27 | + |
| 28 | +This layout preserves the existing public API: tool names, ability names, response envelopes, callbacks, and permission callback names remain unchanged. |
0 commit comments