@@ -90,44 +90,6 @@ private function register_tools( $server, $client ) {
9090 $ map_rest_to_mcp = new MapRESTtoMCP ();
9191 $ map_rest_to_mcp ->map_rest_to_mcp ( $ server );
9292
93- $ server ->register_tool (
94- [
95- 'name ' => 'create_post ' ,
96- 'description ' => 'Creates a post. ' ,
97- 'inputSchema ' => [
98- 'type ' => 'object ' ,
99- 'properties ' => [
100- 'title ' => [
101- 'type ' => 'string ' ,
102- 'description ' => 'The title of the post. ' ,
103- ],
104- 'content ' => [
105- 'type ' => 'string ' ,
106- 'description ' => 'The content of the post. ' ,
107- ],
108- 'category ' => [
109- 'type ' => 'string ' ,
110- 'description ' => 'The category of the post. ' ,
111- ],
112- ],
113- 'required ' => [ 'title ' , 'content ' ],
114- ],
115- 'callable ' => function ( $ params ) {
116- $ request = new \WP_REST_Request ( 'POST ' , '/wp/v2/posts ' );
117- $ request ->set_body_params ( [
118- 'title ' => $ params ['title ' ],
119- 'content ' => $ params ['content ' ],
120- 'categories ' => [ $ params ['category ' ] ],
121- 'status ' => 'publish ' ,
122- ] );
123- $ controller = new \WP_REST_Posts_Controller ( 'post ' );
124- $ response = $ controller ->create_item ( $ request );
125- $ data = $ response ->get_data ();
126- return $ data ;
127- },
128- ]
129- );
130-
13193 $ server ->register_tool (
13294 [
13395 'name ' => 'calculate_total ' ,
@@ -155,77 +117,6 @@ private function register_tools( $server, $client ) {
155117 ]
156118 );
157119
158-
159-
160- // Register tool to retrieve last N posts in JSON format.
161- $ server ->register_tool ([
162- 'name ' => 'list_posts ' ,
163- 'description ' => 'Retrieves the last N posts. ' ,
164- 'inputSchema ' => [
165- 'type ' => 'object ' ,
166- 'properties ' => [
167- 'count ' => [
168- 'type ' => 'integer ' ,
169- 'description ' => 'The number of posts to retrieve. ' ,
170- ],
171- ],
172- 'required ' => ['count ' ],
173- ],
174- 'callable ' => function ($ params ) {
175- $ query = new \WP_Query ([
176- 'posts_per_page ' => $ params ['count ' ],
177- 'post_status ' => 'publish ' ,
178- ]);
179- $ posts = [];
180- while ($ query ->have_posts ()) {
181- $ query ->the_post ();
182- $ posts [] = ['title ' => get_the_title (), 'content ' => get_the_content ()];
183- }
184- wp_reset_postdata ();
185- return $ posts ;
186- },
187- ]);
188-
189- $ server ->register_tool (
190- [
191- 'name ' => 'greet ' ,
192- 'description ' => 'Greets the user. ' ,
193- 'inputSchema ' => [
194- 'type ' => 'object ' ,
195- 'properties ' => [
196- 'name ' => [
197- 'type ' => 'string ' ,
198- 'description ' => 'The name of the user. ' ,
199- ],
200- ],
201- 'required ' => [ 'name ' ],
202- ],
203- 'callable ' => function ( $ params ) {
204- return 'Hello, ' . $ params ['name ' ] . '! ' ;
205- },
206- ]
207- );
208-
209- // $server->register_tool(
210- // [
211- // 'name' => 'generate_image',
212- // 'description' => 'Generates an image.',
213- // 'inputSchema' => [
214- // 'type' => 'object',
215- // 'properties' => [
216- // 'prompt' => [
217- // 'type' => 'string',
218- // 'description' => 'The prompt for generating the image.',
219- // ],
220- // ],
221- // 'required' => [ 'prompt' ],
222- // ],
223- // 'callable' => function ( $params ) use ( $client ) {
224- // return $client->get_image_from_ai_service( $params['prompt'] );
225- // },
226- // ]
227- // );
228-
229120 $ server ->register_tool (
230121 [
231122 'name ' => 'fetch_wp_community_events ' ,
0 commit comments