You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,37 @@ This class follows an MCP client-server architecture, where:
21
21
22
22
| Name | Description |
23
23
| --- | --- |
24
-
|`AiCommand:__invoke( $args, $assoc_args )`| <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> |
25
-
|`AiCommand:register_tools( $server, $client )`| Registers functionality AI can invoke. See [available tools](tools.md). |
26
-
|`AiCommand:register_resources( $server )`| Registers structured datasets AI can access. See [available resources](). |
24
+
|`AiCommand:__invoke( array $args, array $assoc_args )`| <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> |
25
+
|`AiCommand:register_tools( Server $server, $client )`| Registers functionality AI can invoke. See [available tools](tools.md). |
26
+
|`AiCommand:register_resources( Server $server )`| Registers structured datasets AI can access. See [available resources](). |
27
27
28
28
29
29
## `Client` class
30
30
31
+
`Client` class is part of the `WP_CLI\AiCommand\MCP` namespace and serves as an intermediary between the WP-CLI and an AI-based service. It interacts with an MCP (Multi-Client Processor) AI service using JSON-RPC over a local server instance.
32
+
33
+
The service supports:
34
+
35
+
- Sending and receiving requests from the AI service.
36
+
- Retrieving resources from the AI service.
37
+
- Generating images via AI.
38
+
- Processing AI-generated text responses.
39
+
- Managing function calls and executing AI-invoked functions dynamically.
40
+
41
+
### Properties
42
+
43
+
| Name | Visibility modifier | Description |
44
+
| --- | --- | --- |
45
+
|`$server`| private | An instance of MCPServer. |
46
+
47
+
### Methods
48
+
49
+
| Name | Description |
50
+
| --- | --- |
51
+
|`Client:__construct( Server $server )`| Constructor |
52
+
|`Client:send_request( string $method, array $params = [] )`| Constructs a JSON-RPC request, sends it to the AI service, and decodes the response. |
53
+
|`Client:__call( string $name, array $arguments )`| A magic method to call any AI service method dynamically. |
54
+
|`Client:list_resources()`| Retrieves available AI-generated content. |
55
+
|`Client:read_resource( string $uri )`| Reads a specific AI-generated resource. |
0 commit comments