Skip to content

Commit c624bb6

Browse files
committed
Update docs for AiCommand class to include return value. List all REST API controllers as tools.
1 parent 91d628e commit c624bb6

File tree

2 files changed

+92
-6
lines changed

2 files changed

+92
-6
lines changed

docs/reference.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ This class follows an MCP client-server architecture, where:
2626

2727
### Methods
2828

29-
| Name | Description |
30-
| --- | --- |
31-
| `AiCommand::__invoke()` | <ul><li>Creates an AI server and client instance.</li><li>Registers tools & resources for AI processing.</li><li>Sends user input ($args[0]) to AI.</li><li>Outputs AI-generated results.</li></ul> |
32-
| `AiCommand::register_tools()` | Registers functionality AI can invoke. See [available tools](tools.md). |
33-
| `AiCommand::register_resources()` | Registers structured datasets AI can access. See [available resources](). |
34-
29+
| Name | Return Type | Description |
30+
| --- | --- | --- |
31+
| `AiCommand::__invoke()` | `void` | Executes AI-driven WP-CLI commands. |
32+
| `AiCommand::register_tools( $server )` | `void` | Registers AI-powered tools in MCP. See [available tools](tools.md). |
33+
| `AiCommand::register_resources( $server )` | `void` | Registers data resources (e.g., users, products). |
34+
| `AiCommand::list_tools()` | `string` | Lists available AI tools. |
35+
| `AiCommand::fetch_wp_community_events( $params )` | `array` | Retrieves WordPress community events. |
3536

3637
## `Client` class
3738

docs/tools.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,88 @@ wp ai "Calculate total for 5 tickets per 300$ each."
1717
![calculate_total](./assets/calculate_total.gif)
1818

1919
## REST Controllers
20+
21+
All exposed REST API controllers are automatically registered as a tool. The list can be obtained by running following command:
22+
23+
```
24+
wp ai "list all available tools"
25+
```
26+
27+
On a fresh WordPress install, without plugins and custom functionality, the list might look like this:
28+
29+
- `GET_wp-v2-posts`: Retrieves a list of posts.
30+
- `POST_wp-v2-posts`: Creates a new post.
31+
- `GET_wp-v2-posts-p_id`: Retrieves a specific post by ID.
32+
- `POST_wp-v2-posts-p_id`: Creates a post with a specific ID.
33+
- `PUT_wp-v2-posts-p_id`: Updates a specific post by ID.
34+
- `PATCH_wp-v2-posts-p_id`: Partially updates a specific post by ID.
35+
- `DELETE_wp-v2-posts-p_id`: Deletes a specific post by ID.
36+
- `GET_wp-v2-pages`: Retrieves a list of pages.
37+
- `POST_wp-v2-pages`: Creates a new page.
38+
- `GET_wp-v2-pages-p_id`: Retrieves a specific page by ID.
39+
- `POST_wp-v2-pages-p_id`: Creates a page with a specific ID.
40+
- `PUT_wp-v2-pages-p_id`: Updates a specific page by ID.
41+
- `PATCH_wp-v2-pages-p_id`: Partially updates a specific page by ID.
42+
- `DELETE_wp-v2-pages-p_id`: Deletes a specific page by ID.
43+
- `GET_wp-v2-media`: Retrieves a list of media items (attachments).
44+
- `POST_wp-v2-media`: Creates a new media item (attachment).
45+
- `GET_wp-v2-media-p_id`: Retrieves a specific media item (attachment) by ID.
46+
- `POST_wp-v2-media-p_id`: Creates a media item with a specific ID.
47+
- `PUT_wp-v2-media-p_id`: Updates a specific media item (attachment) by ID.
48+
- `PATCH_wp-v2-media-p_id`: Partially updates a specific media item (attachment) by ID.
49+
- `DELETE_wp-v2-media-p_id`: Deletes a specific media item (attachment) by ID.
50+
- `POST_wp-v2-media-p_id-post-process`: Processes a media item after it has been posted.
51+
- `POST_wp-v2-media-p_id-edit`: Edits a media item.
52+
- `GET_wp-v2-menu-items`: Retrieves a list of menu items.
53+
- `POST_wp-v2-menu-items`: Creates a new menu item.
54+
- `GET_wp-v2-menu-items-p_id`: Retrieves a specific menu item by ID.
55+
- `POST_wp-v2-menu-items-p_id`: Creates a menu item with a specific ID.
56+
- `PUT_wp-v2-menu-items-p_id`: Updates a specific menu item by ID.
57+
- `PATCH_wp-v2-menu-items-p_id`: Partially updates a specific menu item by ID.
58+
- `DELETE_wp-v2-menu-items-p_id`: Deletes a specific menu item by ID.
59+
- `GET_wp-v2-blocks`: Retrieves a list of blocks.
60+
- `POST_wp-v2-blocks`: Creates a new block.
61+
- `GET_wp-v2-blocks-p_id`: Retrieves a specific block by ID.
62+
- `POST_wp-v2-blocks-p_id`: Creates a block with a specific ID.
63+
- `PUT_wp-v2-blocks-p_id`: Updates a specific block by ID.
64+
- `PATCH_wp-v2-blocks-p_id`: Partially updates a specific block by ID.
65+
- `DELETE_wp-v2-blocks-p_id`: Deletes a specific block by ID.
66+
- `GET_wp-v2-global-styles-themes-p_stylesheet-variations`: Retrieves a list of global style variations for a theme.
67+
- `GET_wp-v2-global-styles-themes-p_stylesheet`: Retrieves global styles for a theme.
68+
- `GET_wp-v2-global-styles-p_id`: Retrieves global styles by ID.
69+
- `POST_wp-v2-global-styles-p_id`: Creates global styles.
70+
- `PUT_wp-v2-global-styles-p_id`: Updates global styles.
71+
- `PATCH_wp-v2-global-styles-p_id`: Partially updates global styles.
72+
- `GET_wp-v2-navigation`: Retrieves a list of navigations.
73+
- `POST_wp-v2-navigation`: Creates a new navigation.
74+
- `GET_wp-v2-navigation-p_id`: Retrieves a specific navigation by ID.
75+
- `POST_wp-v2-navigation-p_id`: Creates a navigation with a specific ID.
76+
- `PUT_wp-v2-navigation-p_id`: Updates a specific navigation by ID.
77+
- `PATCH_wp-v2-navigation-p_id`: Partially updates a specific navigation by ID.
78+
- `DELETE_wp-v2-navigation-p_id`: Deletes a specific navigation by ID.
79+
- `GET_wp-v2-font-families`: Retrieves a list of font families.
80+
- `POST_wp-v2-font-families`: Creates a new font family.
81+
- `GET_wp-v2-font-families-p_id`: Retrieves a specific font family by ID.
82+
- `POST_wp-v2-font-families-p_id`: Creates a font family with a specific ID.
83+
- `PUT_wp-v2-font-families-p_id`: Updates a specific font family by ID.
84+
- `PATCH_wp-v2-font-families-p_id`: Partially updates a specific font family by ID.
85+
- `DELETE_wp-v2-font-families-p_id`: Deletes a specific font family by ID.
86+
- `GET_wp-v2-font-families-p_font_family_id-font-faces`: Retrieves a list of font faces for a font family.
87+
- `POST_wp-v2-font-families-p_font_family_id-font-faces`: Creates a new font face for a font family.
88+
- `GET_wp-v2-font-families-p_font_family_id`: Retrieves a specific font face.
89+
- `DELETE_wp-v2-font-families-p_font_family_id`: Deletes a specific font face.
90+
- `GET_wp-v2-taxonomies`: Retrieves a list of taxonomies.
91+
- `GET_wp-v2-taxonomies-p_taxonomy`: Retrieves a specific taxonomy by ID.
92+
- `GET_wp-v2-users`: Retrieves a list of users.
93+
- `POST_wp-v2-users`: Creates a new user.
94+
- `GET_wp-v2-users-p_id`: Retrieves a specific user by ID.
95+
- `POST_wp-v2-users-p_id`: Creates a user with a specific ID.
96+
- `PUT_wp-v2-users-p_id`: Updates a specific user by ID.
97+
- `PATCH_wp-v2-users-p_id`: Partially updates a specific user by ID.
98+
- `DELETE_wp-v2-users-p_id`: Deletes a specific user by ID.
99+
- `GET_wp-v2-users-me`: Retrieves the current user.
100+
- `POST_wp-v2-users-me`: Creates the current user.
101+
- `PUT_wp-v2-users-me`: Updates the current user.
102+
- `PATCH_wp-v2-users-me`: Partially updates the current user.
103+
- `DELETE_wp-v2-users-me`: Deletes the current user.
104+

0 commit comments

Comments
 (0)