Skip to content

Commit c450c51

Browse files
committed
Make tool registration more concise
1 parent 61b6f40 commit c450c51

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

ai-command.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,15 @@
2323

2424
// TODO Register your tool here and add it to the collection
2525

26-
$image_tools = new ImageTools($client);
26+
$all_tools = [
27+
...(new ImageTools($client))->get_tools(),
28+
...(new MapRESTtoMCP())->map_rest_to_mcp(),
29+
];
2730

28-
foreach($image_tools->get_tools() as $tool){
31+
foreach ($all_tools as $tool) {
2932
$tools->add($tool);
3033
}
3134

32-
33-
// WordPress REST calls
34-
$rest_tools = new MapRESTtoMCP();
35-
36-
foreach( $rest_tools->map_rest_to_mcp() as $tool ) {
37-
$tools->add( $tool );
38-
}
39-
4035
$ai_command = new AiCommand(
4136
new CollectionToolRepository( $tools ),
4237
$server,

0 commit comments

Comments
 (0)