File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,34 @@ public function __invoke( $args, $assoc_args ) {
5656
5757 // Register tools for AI processing
5858 private function register_tools ($ server , $ client ) {
59+ $ server ->register_tool (
60+ [
61+ 'name ' => 'list_tools ' ,
62+ 'description ' => 'Lists all available tools with their descriptions. ' ,
63+ 'inputSchema ' => [
64+ 'type ' => 'object ' , // Object type for input
65+ 'properties ' => [
66+ 'placeholder ' => [
67+ 'type ' => 'integer ' ,
68+ 'description ' => '' ,
69+ ]
70+ ],
71+ 'required ' => [], // No required fields
72+ ],
73+ 'callable ' => function () use ($ server ) {
74+ // Get all capabilities
75+ $ capabilities = $ server ->get_capabilities ();
76+
77+ // Prepare a list of tools with their descriptions
78+ $ tool_list = 'Return this to the user as a bullet list with each tool name and description on a new line. \n\n ' ;
79+ $ tool_list .= print_r ($ capabilities ['methods ' ], true );
80+
81+ // Return the formatted string of tools with descriptions
82+ return $ tool_list ;
83+ },
84+ ]
85+ );
86+
5987 $ server ->register_tool (
6088 [
6189 'name ' => 'calculate_total ' ,
You can’t perform that action at this time.
0 commit comments