Skip to main content

rustyclaw_core/tools/
params.rs

1//! Tool parameter definitions for RustyClaw.
2//!
3//! Each `*_params()` function returns the parameter schema for a tool,
4//! which is used by provider formatters to generate JSON Schema.
5
6use super::ToolParam;
7
8pub fn read_file_params() -> Vec<ToolParam> {
9    vec![
10        ToolParam {
11            name: "path".into(),
12            description: "Path to the file to read. IMPORTANT: if you received \
13                          an absolute path from find_files or search_files \
14                          (starting with /), pass it exactly as-is. Only \
15                          relative paths are resolved against the workspace root."
16                .into(),
17            param_type: "string".into(),
18            required: true,
19        },
20        ToolParam {
21            name: "start_line".into(),
22            description: "First line to read (1-based, inclusive). Omit to start from the beginning.".into(),
23            param_type: "integer".into(),
24            required: false,
25        },
26        ToolParam {
27            name: "end_line".into(),
28            description: "Last line to read (1-based, inclusive). Omit to read to the end.".into(),
29            param_type: "integer".into(),
30            required: false,
31        },
32    ]
33}
34
35pub fn write_file_params() -> Vec<ToolParam> {
36    vec![
37        ToolParam {
38            name: "path".into(),
39            description: "Path to the file to create or overwrite.".into(),
40            param_type: "string".into(),
41            required: true,
42        },
43        ToolParam {
44            name: "content".into(),
45            description: "The full content to write to the file.".into(),
46            param_type: "string".into(),
47            required: true,
48        },
49    ]
50}
51
52pub fn edit_file_params() -> Vec<ToolParam> {
53    vec![
54        ToolParam {
55            name: "path".into(),
56            description: "Path to the file to edit.".into(),
57            param_type: "string".into(),
58            required: true,
59        },
60        ToolParam {
61            name: "old_string".into(),
62            description: "The exact text to find (must match exactly once). \
63                          Include surrounding context lines for uniqueness."
64                .into(),
65            param_type: "string".into(),
66            required: true,
67        },
68        ToolParam {
69            name: "new_string".into(),
70            description: "The replacement text.".into(),
71            param_type: "string".into(),
72            required: true,
73        },
74    ]
75}
76
77pub fn list_directory_params() -> Vec<ToolParam> {
78    vec![ToolParam {
79        name: "path".into(),
80        description: "Path to the directory to list.".into(),
81        param_type: "string".into(),
82        required: true,
83    }]
84}
85
86pub fn search_files_params() -> Vec<ToolParam> {
87    vec![
88        ToolParam {
89            name: "pattern".into(),
90            description: "The text pattern to search for inside files.".into(),
91            param_type: "string".into(),
92            required: true,
93        },
94        ToolParam {
95            name: "path".into(),
96            description: "Directory to search in. Defaults to the workspace root. \
97                          Use an absolute path (e.g. '/Users/alice/Documents') to \
98                          search outside the workspace."
99                .into(),
100            param_type: "string".into(),
101            required: false,
102        },
103        ToolParam {
104            name: "include".into(),
105            description: "Glob pattern to filter filenames (e.g. '*.rs').".into(),
106            param_type: "string".into(),
107            required: false,
108        },
109    ]
110}
111
112pub fn find_files_params() -> Vec<ToolParam> {
113    vec![
114        ToolParam {
115            name: "pattern".into(),
116            description: "Search term(s) or glob pattern. Plain words are matched \
117                          case-insensitively against file names (e.g. 'resume' \
118                          matches Resume.pdf). Separate multiple keywords with \
119                          spaces to match ANY (e.g. 'resume cv'). Use glob \
120                          syntax ('*', '?') for extension filters (e.g. '*.pdf')."
121                .into(),
122            param_type: "string".into(),
123            required: true,
124        },
125        ToolParam {
126            name: "path".into(),
127            description: "Base directory for the search. Defaults to the workspace root. \
128                          Use an absolute path (e.g. '/Users/alice' or '~') to \
129                          search outside the workspace."
130                .into(),
131            param_type: "string".into(),
132            required: false,
133        },
134    ]
135}
136
137pub fn execute_command_params() -> Vec<ToolParam> {
138    vec![
139        ToolParam {
140            name: "command".into(),
141            description: "The shell command to execute (passed to sh -c).".into(),
142            param_type: "string".into(),
143            required: true,
144        },
145        ToolParam {
146            name: "working_dir".into(),
147            description: "Working directory for the command. Defaults to the workspace root. \
148                          Use an absolute path to run elsewhere."
149                .into(),
150            param_type: "string".into(),
151            required: false,
152        },
153        ToolParam {
154            name: "timeout_secs".into(),
155            description: "Maximum seconds before killing the command (default: 30).".into(),
156            param_type: "integer".into(),
157            required: false,
158        },
159        ToolParam {
160            name: "background".into(),
161            description: "Run in background immediately. Returns a sessionId for use with process tool.".into(),
162            param_type: "boolean".into(),
163            required: false,
164        },
165        ToolParam {
166            name: "yieldMs".into(),
167            description: "Milliseconds to wait before auto-backgrounding (default: 10000). \
168                          Set to 0 to disable auto-background."
169                .into(),
170            param_type: "integer".into(),
171            required: false,
172        },
173    ]
174}
175
176pub fn web_fetch_params() -> Vec<ToolParam> {
177    vec![
178        ToolParam {
179            name: "url".into(),
180            description: "HTTP or HTTPS URL to fetch.".into(),
181            param_type: "string".into(),
182            required: true,
183        },
184        ToolParam {
185            name: "extract_mode".into(),
186            description: "Extraction mode: 'markdown' (default) or 'text'. \
187                          Markdown preserves links and structure; text is plain."
188                .into(),
189            param_type: "string".into(),
190            required: false,
191        },
192        ToolParam {
193            name: "max_chars".into(),
194            description: "Maximum characters to return (truncates if exceeded). \
195                          Default: 50000."
196                .into(),
197            param_type: "integer".into(),
198            required: false,
199        },
200        ToolParam {
201            name: "use_cookies".into(),
202            description: "Use stored cookies for this request and save any \
203                          Set-Cookie headers from the response. Follows browser \
204                          security rules (domain scoping, Secure flag). Default: false."
205                .into(),
206            param_type: "boolean".into(),
207            required: false,
208        },
209    ]
210}
211
212pub fn web_search_params() -> Vec<ToolParam> {
213    vec![
214        ToolParam {
215            name: "query".into(),
216            description: "Search query string.".into(),
217            param_type: "string".into(),
218            required: true,
219        },
220        ToolParam {
221            name: "count".into(),
222            description: "Number of results to return (1-10). Default: 5.".into(),
223            param_type: "integer".into(),
224            required: false,
225        },
226        ToolParam {
227            name: "country".into(),
228            description: "2-letter country code for region-specific results (e.g., 'DE', 'US'). \
229                          Default: 'US'."
230                .into(),
231            param_type: "string".into(),
232            required: false,
233        },
234        ToolParam {
235            name: "search_lang".into(),
236            description: "ISO language code for search results (e.g., 'de', 'en', 'fr').".into(),
237            param_type: "string".into(),
238            required: false,
239        },
240        ToolParam {
241            name: "freshness".into(),
242            description: "Filter results by discovery time. Values: 'pd' (past 24h), \
243                          'pw' (past week), 'pm' (past month), 'py' (past year), \
244                          or date range 'YYYY-MM-DDtoYYYY-MM-DD'."
245                .into(),
246            param_type: "string".into(),
247            required: false,
248        },
249    ]
250}
251
252pub fn process_params() -> Vec<ToolParam> {
253    vec![
254        ToolParam {
255            name: "action".into(),
256            description: "Action to perform: 'list', 'poll', 'log', 'write', 'send_keys', 'kill', 'clear', 'remove'.".into(),
257            param_type: "string".into(),
258            required: true,
259        },
260        ToolParam {
261            name: "sessionId".into(),
262            description: "Session ID for poll/log/write/send_keys/kill/remove actions.".into(),
263            param_type: "string".into(),
264            required: false,
265        },
266        ToolParam {
267            name: "data".into(),
268            description: "Data to write to stdin (for 'write' action).".into(),
269            param_type: "string".into(),
270            required: false,
271        },
272        ToolParam {
273            name: "keys".into(),
274            description: "Space-separated key names to send (for 'send_keys' action). Supports: Enter, Tab, Escape, Space, Backspace, Up, Down, Left, Right, Home, End, PageUp, PageDown, Delete, Insert, Ctrl-A..Ctrl-Z, F1..F12, or literal text.".into(),
275            param_type: "string".into(),
276            required: false,
277        },
278        ToolParam {
279            name: "offset".into(),
280            description: "Line offset for 'log' action (0-indexed). Omit to get last N lines.".into(),
281            param_type: "integer".into(),
282            required: false,
283        },
284        ToolParam {
285            name: "limit".into(),
286            description: "Maximum lines to return for 'log' action. Default: 50.".into(),
287            param_type: "integer".into(),
288            required: false,
289        },
290    ]
291}
292
293pub fn memory_search_params() -> Vec<ToolParam> {
294    vec![
295        ToolParam {
296            name: "query".into(),
297            description: "Search query for finding relevant memory content.".into(),
298            param_type: "string".into(),
299            required: true,
300        },
301        ToolParam {
302            name: "maxResults".into(),
303            description: "Maximum number of results to return. Default: 5.".into(),
304            param_type: "integer".into(),
305            required: false,
306        },
307        ToolParam {
308            name: "minScore".into(),
309            description: "Minimum relevance score threshold (0.0-1.0). Default: 0.1.".into(),
310            param_type: "number".into(),
311            required: false,
312        },
313        ToolParam {
314            name: "recencyBoost".into(),
315            description: "Enable recency weighting to boost recent memories. Default: true.".into(),
316            param_type: "boolean".into(),
317            required: false,
318        },
319        ToolParam {
320            name: "halfLifeDays".into(),
321            description: "Half-life for temporal decay in days. Lower values favor recent memories more strongly. Default: 30.".into(),
322            param_type: "number".into(),
323            required: false,
324        },
325    ]
326}
327
328pub fn memory_get_params() -> Vec<ToolParam> {
329    vec![
330        ToolParam {
331            name: "path".into(),
332            description: "Path to the memory file (MEMORY.md or memory/*.md).".into(),
333            param_type: "string".into(),
334            required: true,
335        },
336        ToolParam {
337            name: "from".into(),
338            description: "Starting line number (1-indexed). Default: 1.".into(),
339            param_type: "integer".into(),
340            required: false,
341        },
342        ToolParam {
343            name: "lines".into(),
344            description: "Number of lines to read. Default: entire file.".into(),
345            param_type: "integer".into(),
346            required: false,
347        },
348    ]
349}
350
351pub fn secrets_list_params() -> Vec<ToolParam> {
352    vec![ToolParam {
353        name: "prefix".into(),
354        description: "Optional prefix to filter key names.".into(),
355        param_type: "string".into(),
356        required: false,
357    }]
358}
359
360pub fn secrets_get_params() -> Vec<ToolParam> {
361    vec![ToolParam {
362        name: "key".into(),
363        description: "The name of the secret to retrieve.".into(),
364        param_type: "string".into(),
365        required: true,
366    }]
367}
368
369pub fn secrets_store_params() -> Vec<ToolParam> {
370    vec![
371        ToolParam {
372            name: "key".into(),
373            description: "The name under which to store the secret.".into(),
374            param_type: "string".into(),
375            required: true,
376        },
377        ToolParam {
378            name: "value".into(),
379            description: "The secret value to encrypt and store.".into(),
380            param_type: "string".into(),
381            required: true,
382        },
383    ]
384}
385
386pub fn gateway_params() -> Vec<ToolParam> {
387    vec![
388        ToolParam {
389            name: "action".into(),
390            description: "Action: 'restart', 'config.get', 'config.schema', 'config.apply', 'config.patch', 'update.run'.".into(),
391            param_type: "string".into(),
392            required: true,
393        },
394        ToolParam {
395            name: "raw".into(),
396            description: "JSON config content for config.apply or config.patch.".into(),
397            param_type: "string".into(),
398            required: false,
399        },
400        ToolParam {
401            name: "baseHash".into(),
402            description: "Config hash from config.get (required for apply/patch when config exists).".into(),
403            param_type: "string".into(),
404            required: false,
405        },
406        ToolParam {
407            name: "reason".into(),
408            description: "Reason for restart or config change.".into(),
409            param_type: "string".into(),
410            required: false,
411        },
412        ToolParam {
413            name: "delayMs".into(),
414            description: "Delay before restart in milliseconds. Default: 2000.".into(),
415            param_type: "integer".into(),
416            required: false,
417        },
418    ]
419}
420
421pub fn message_params() -> Vec<ToolParam> {
422    vec![
423        ToolParam {
424            name: "action".into(),
425            description: "Action: 'send' or 'broadcast'.".into(),
426            param_type: "string".into(),
427            required: true,
428        },
429        ToolParam {
430            name: "message".into(),
431            description: "Message content to send.".into(),
432            param_type: "string".into(),
433            required: false,
434        },
435        ToolParam {
436            name: "target".into(),
437            description: "Target channel/user ID or name.".into(),
438            param_type: "string".into(),
439            required: false,
440        },
441        ToolParam {
442            name: "channel".into(),
443            description: "Channel type: telegram, discord, whatsapp, signal, slack, etc.".into(),
444            param_type: "string".into(),
445            required: false,
446        },
447        ToolParam {
448            name: "targets".into(),
449            description: "Multiple targets for broadcast action.".into(),
450            param_type: "array".into(),
451            required: false,
452        },
453        ToolParam {
454            name: "replyTo".into(),
455            description: "Message ID to reply to.".into(),
456            param_type: "string".into(),
457            required: false,
458        },
459        ToolParam {
460            name: "silent".into(),
461            description: "Send without notification. Default: false.".into(),
462            param_type: "boolean".into(),
463            required: false,
464        },
465    ]
466}
467
468pub fn tts_params() -> Vec<ToolParam> {
469    vec![
470        ToolParam {
471            name: "text".into(),
472            description: "Text to convert to speech.".into(),
473            param_type: "string".into(),
474            required: true,
475        },
476        ToolParam {
477            name: "channel".into(),
478            description: "Optional channel ID to pick output format.".into(),
479            param_type: "string".into(),
480            required: false,
481        },
482    ]
483}
484
485pub fn image_params() -> Vec<ToolParam> {
486    vec![
487        ToolParam {
488            name: "image".into(),
489            description: "Path to local image file or URL.".into(),
490            param_type: "string".into(),
491            required: true,
492        },
493        ToolParam {
494            name: "prompt".into(),
495            description: "Question or instruction about the image. Default: 'Describe the image.'".into(),
496            param_type: "string".into(),
497            required: false,
498        },
499    ]
500}
501
502pub fn nodes_params() -> Vec<ToolParam> {
503    vec![
504        ToolParam {
505            name: "action".into(),
506            description: "Action: 'status', 'describe', 'pending', 'approve', 'reject', 'notify', 'camera_snap', 'camera_list', 'screen_record', 'location_get', 'run', 'invoke'.".into(),
507            param_type: "string".into(),
508            required: true,
509        },
510        ToolParam {
511            name: "node".into(),
512            description: "Node ID or name to target.".into(),
513            param_type: "string".into(),
514            required: false,
515        },
516        ToolParam {
517            name: "requestId".into(),
518            description: "Pairing request ID for approve/reject.".into(),
519            param_type: "string".into(),
520            required: false,
521        },
522        ToolParam {
523            name: "title".into(),
524            description: "Notification title.".into(),
525            param_type: "string".into(),
526            required: false,
527        },
528        ToolParam {
529            name: "body".into(),
530            description: "Notification body text.".into(),
531            param_type: "string".into(),
532            required: false,
533        },
534        ToolParam {
535            name: "command".into(),
536            description: "Command array for 'run' action.".into(),
537            param_type: "array".into(),
538            required: false,
539        },
540        ToolParam {
541            name: "invokeCommand".into(),
542            description: "Command name for 'invoke' action.".into(),
543            param_type: "string".into(),
544            required: false,
545        },
546        ToolParam {
547            name: "facing".into(),
548            description: "Camera facing: 'front', 'back', or 'both'.".into(),
549            param_type: "string".into(),
550            required: false,
551        },
552    ]
553}
554
555pub fn browser_params() -> Vec<ToolParam> {
556    vec![
557        ToolParam {
558            name: "action".into(),
559            description: "Action: 'status', 'start', 'stop', 'profiles', 'tabs', 'open', 'focus', 'close', 'snapshot', 'screenshot', 'navigate', 'console', 'pdf', 'act'.".into(),
560            param_type: "string".into(),
561            required: true,
562        },
563        ToolParam {
564            name: "profile".into(),
565            description: "Browser profile: 'openclaw' (managed) or 'chrome' (extension relay).".into(),
566            param_type: "string".into(),
567            required: false,
568        },
569        ToolParam {
570            name: "targetUrl".into(),
571            description: "URL for 'open' or 'navigate' actions.".into(),
572            param_type: "string".into(),
573            required: false,
574        },
575        ToolParam {
576            name: "targetId".into(),
577            description: "Tab ID for targeting specific tab.".into(),
578            param_type: "string".into(),
579            required: false,
580        },
581        ToolParam {
582            name: "ref".into(),
583            description: "Element reference from snapshot for actions.".into(),
584            param_type: "string".into(),
585            required: false,
586        },
587        ToolParam {
588            name: "request".into(),
589            description: "Action request object with kind (click/type/press/hover/drag), ref, text, etc.".into(),
590            param_type: "object".into(),
591            required: false,
592        },
593        ToolParam {
594            name: "fullPage".into(),
595            description: "Capture full page for screenshot. Default: false.".into(),
596            param_type: "boolean".into(),
597            required: false,
598        },
599    ]
600}
601
602pub fn canvas_params() -> Vec<ToolParam> {
603    vec![
604        ToolParam {
605            name: "action".into(),
606            description: "Action: 'present', 'hide', 'navigate', 'eval', 'snapshot', 'a2ui_push', 'a2ui_reset'.".into(),
607            param_type: "string".into(),
608            required: true,
609        },
610        ToolParam {
611            name: "node".into(),
612            description: "Target node for canvas operations.".into(),
613            param_type: "string".into(),
614            required: false,
615        },
616        ToolParam {
617            name: "url".into(),
618            description: "URL to present or navigate to.".into(),
619            param_type: "string".into(),
620            required: false,
621        },
622        ToolParam {
623            name: "javaScript".into(),
624            description: "JavaScript code for 'eval' action.".into(),
625            param_type: "string".into(),
626            required: false,
627        },
628        ToolParam {
629            name: "width".into(),
630            description: "Canvas width in pixels.".into(),
631            param_type: "integer".into(),
632            required: false,
633        },
634        ToolParam {
635            name: "height".into(),
636            description: "Canvas height in pixels.".into(),
637            param_type: "integer".into(),
638            required: false,
639        },
640    ]
641}
642
643pub fn cron_params() -> Vec<ToolParam> {
644    vec![
645        ToolParam {
646            name: "action".into(),
647            description: "Action: 'status', 'list', 'add', 'update', 'remove', 'run', 'runs'.".into(),
648            param_type: "string".into(),
649            required: true,
650        },
651        ToolParam {
652            name: "jobId".into(),
653            description: "Job ID for update/remove/run/runs actions.".into(),
654            param_type: "string".into(),
655            required: false,
656        },
657        ToolParam {
658            name: "job".into(),
659            description: "Job definition object for 'add' action.".into(),
660            param_type: "object".into(),
661            required: false,
662        },
663        ToolParam {
664            name: "patch".into(),
665            description: "Patch object for 'update' action.".into(),
666            param_type: "object".into(),
667            required: false,
668        },
669        ToolParam {
670            name: "includeDisabled".into(),
671            description: "Include disabled jobs in list. Default: false.".into(),
672            param_type: "boolean".into(),
673            required: false,
674        },
675    ]
676}
677
678pub fn sessions_list_params() -> Vec<ToolParam> {
679    vec![
680        ToolParam {
681            name: "kinds".into(),
682            description: "Filter by session kinds: 'main', 'subagent', 'cron'.".into(),
683            param_type: "array".into(),
684            required: false,
685        },
686        ToolParam {
687            name: "activeMinutes".into(),
688            description: "Only show sessions active within N minutes.".into(),
689            param_type: "integer".into(),
690            required: false,
691        },
692        ToolParam {
693            name: "limit".into(),
694            description: "Maximum sessions to return. Default: 20.".into(),
695            param_type: "integer".into(),
696            required: false,
697        },
698        ToolParam {
699            name: "messageLimit".into(),
700            description: "Include last N messages per session.".into(),
701            param_type: "integer".into(),
702            required: false,
703        },
704    ]
705}
706
707pub fn sessions_spawn_params() -> Vec<ToolParam> {
708    vec![
709        ToolParam {
710            name: "task".into(),
711            description: "What the sub-agent should do (required).".into(),
712            param_type: "string".into(),
713            required: true,
714        },
715        ToolParam {
716            name: "label".into(),
717            description: "Short label for identification.".into(),
718            param_type: "string".into(),
719            required: false,
720        },
721        ToolParam {
722            name: "agentId".into(),
723            description: "Spawn under a different agent ID.".into(),
724            param_type: "string".into(),
725            required: false,
726        },
727        ToolParam {
728            name: "model".into(),
729            description: "Override the model for this sub-agent.".into(),
730            param_type: "string".into(),
731            required: false,
732        },
733        ToolParam {
734            name: "thinking".into(),
735            description: "Override thinking level (off/low/medium/high).".into(),
736            param_type: "string".into(),
737            required: false,
738        },
739        ToolParam {
740            name: "runTimeoutSeconds".into(),
741            description: "Abort sub-agent after N seconds.".into(),
742            param_type: "integer".into(),
743            required: false,
744        },
745        ToolParam {
746            name: "cleanup".into(),
747            description: "'delete' or 'keep' session after completion.".into(),
748            param_type: "string".into(),
749            required: false,
750        },
751    ]
752}
753
754pub fn sessions_send_params() -> Vec<ToolParam> {
755    vec![
756        ToolParam {
757            name: "message".into(),
758            description: "Message to send to the target session.".into(),
759            param_type: "string".into(),
760            required: true,
761        },
762        ToolParam {
763            name: "sessionKey".into(),
764            description: "Session key to send to.".into(),
765            param_type: "string".into(),
766            required: false,
767        },
768        ToolParam {
769            name: "label".into(),
770            description: "Session label to send to (alternative to sessionKey).".into(),
771            param_type: "string".into(),
772            required: false,
773        },
774        ToolParam {
775            name: "timeoutSeconds".into(),
776            description: "Timeout for waiting on response.".into(),
777            param_type: "integer".into(),
778            required: false,
779        },
780    ]
781}
782
783pub fn sessions_history_params() -> Vec<ToolParam> {
784    vec![
785        ToolParam {
786            name: "sessionKey".into(),
787            description: "Session key to get history for.".into(),
788            param_type: "string".into(),
789            required: true,
790        },
791        ToolParam {
792            name: "limit".into(),
793            description: "Maximum messages to return. Default: 20.".into(),
794            param_type: "integer".into(),
795            required: false,
796        },
797        ToolParam {
798            name: "includeTools".into(),
799            description: "Include tool call messages. Default: false.".into(),
800            param_type: "boolean".into(),
801            required: false,
802        },
803    ]
804}
805
806pub fn session_status_params() -> Vec<ToolParam> {
807    vec![
808        ToolParam {
809            name: "sessionKey".into(),
810            description: "Session key to get status for. Default: current session.".into(),
811            param_type: "string".into(),
812            required: false,
813        },
814        ToolParam {
815            name: "model".into(),
816            description: "Set per-session model override. Use 'default' to reset.".into(),
817            param_type: "string".into(),
818            required: false,
819        },
820    ]
821}
822
823pub fn agents_list_params() -> Vec<ToolParam> {
824    vec![]
825}
826
827pub fn apply_patch_params() -> Vec<ToolParam> {
828    vec![
829        ToolParam {
830            name: "patch".into(),
831            description: "Unified diff patch content to apply.".into(),
832            param_type: "string".into(),
833            required: true,
834        },
835        ToolParam {
836            name: "path".into(),
837            description: "Target file path. If not specified, parsed from patch header.".into(),
838            param_type: "string".into(),
839            required: false,
840        },
841        ToolParam {
842            name: "dry_run".into(),
843            description: "If true, validate patch without applying. Default: false.".into(),
844            param_type: "boolean".into(),
845            required: false,
846        },
847    ]
848}
849
850// ── Skill tool parameters ───────────────────────────────────────────────────
851
852pub fn skill_list_params() -> Vec<ToolParam> {
853    vec![ToolParam {
854        name: "filter".into(),
855        description: "Optional filter: 'all' (default), 'enabled', 'disabled', 'registry'.".into(),
856        param_type: "string".into(),
857        required: false,
858    }]
859}
860
861pub fn skill_search_params() -> Vec<ToolParam> {
862    vec![ToolParam {
863        name: "query".into(),
864        description: "Search query for the ClawHub registry.".into(),
865        param_type: "string".into(),
866        required: true,
867    }]
868}
869
870pub fn skill_install_params() -> Vec<ToolParam> {
871    vec![
872        ToolParam {
873            name: "name".into(),
874            description: "Name of the skill to install from ClawHub.".into(),
875            param_type: "string".into(),
876            required: true,
877        },
878        ToolParam {
879            name: "version".into(),
880            description: "Specific version to install (default: latest).".into(),
881            param_type: "string".into(),
882            required: false,
883        },
884    ]
885}
886
887pub fn skill_info_params() -> Vec<ToolParam> {
888    vec![ToolParam {
889        name: "name".into(),
890        description: "Name of the skill to get info about.".into(),
891        param_type: "string".into(),
892        required: true,
893    }]
894}
895
896pub fn skill_enable_params() -> Vec<ToolParam> {
897    vec![
898        ToolParam {
899            name: "name".into(),
900            description: "Name of the skill to enable or disable.".into(),
901            param_type: "string".into(),
902            required: true,
903        },
904        ToolParam {
905            name: "enabled".into(),
906            description: "Whether to enable (true) or disable (false) the skill.".into(),
907            param_type: "boolean".into(),
908            required: true,
909        },
910    ]
911}
912
913pub fn skill_link_secret_params() -> Vec<ToolParam> {
914    vec![
915        ToolParam {
916            name: "action".into(),
917            description: "Action: 'link' or 'unlink'.".into(),
918            param_type: "string".into(),
919            required: true,
920        },
921        ToolParam {
922            name: "skill".into(),
923            description: "Name of the skill.".into(),
924            param_type: "string".into(),
925            required: true,
926        },
927        ToolParam {
928            name: "secret".into(),
929            description: "Name of the vault credential to link/unlink.".into(),
930            param_type: "string".into(),
931            required: true,
932        },
933    ]
934}
935
936pub fn skill_create_params() -> Vec<ToolParam> {
937    vec![
938        ToolParam {
939            name: "name".into(),
940            description: "Kebab-case skill name used as the directory name (e.g. 'deploy-s3').".into(),
941            param_type: "string".into(),
942            required: true,
943        },
944        ToolParam {
945            name: "description".into(),
946            description: "A concise one-line description of what this skill does.".into(),
947            param_type: "string".into(),
948            required: true,
949        },
950        ToolParam {
951            name: "instructions".into(),
952            description: "The full markdown body of the skill (everything after the YAML frontmatter). \
953                           Include step-by-step guidance, tool usage patterns, and any constraints.".into(),
954            param_type: "string".into(),
955            required: true,
956        },
957        ToolParam {
958            name: "metadata".into(),
959            description: "Optional JSON metadata string, e.g. \
960                           '{\"openclaw\": {\"emoji\": \"⚡\", \"requires\": {\"bins\": [\"git\"]}}}'.".into(),
961            param_type: "string".into(),
962            required: false,
963        },
964    ]
965}
966
967// ── System tools ────────────────────────────────────────────────────────────
968
969pub fn disk_usage_params() -> Vec<ToolParam> {
970    vec![
971        ToolParam {
972            name: "path".into(),
973            description: "Directory to scan. Defaults to '~'.".into(),
974            param_type: "string".into(),
975            required: false,
976        },
977        ToolParam {
978            name: "depth".into(),
979            description: "Max depth to traverse (default 1).".into(),
980            param_type: "integer".into(),
981            required: false,
982        },
983        ToolParam {
984            name: "top".into(),
985            description: "Number of largest entries to return (default 20).".into(),
986            param_type: "integer".into(),
987            required: false,
988        },
989    ]
990}
991
992pub fn classify_files_params() -> Vec<ToolParam> {
993    vec![ToolParam {
994        name: "path".into(),
995        description: "Directory whose contents should be classified.".into(),
996        param_type: "string".into(),
997        required: true,
998    }]
999}
1000
1001pub fn system_monitor_params() -> Vec<ToolParam> {
1002    vec![ToolParam {
1003        name: "metric".into(),
1004        description: "Which metric to query: 'cpu', 'memory', 'disk', 'network', or 'all' (default 'all').".into(),
1005        param_type: "string".into(),
1006        required: false,
1007    }]
1008}
1009
1010pub fn battery_health_params() -> Vec<ToolParam> {
1011    vec![]
1012}
1013
1014pub fn app_index_params() -> Vec<ToolParam> {
1015    vec![
1016        ToolParam {
1017            name: "filter".into(),
1018            description: "Optional substring filter for app names.".into(),
1019            param_type: "string".into(),
1020            required: false,
1021        },
1022        ToolParam {
1023            name: "sort".into(),
1024            description: "Sort order: 'size' (default) or 'name'.".into(),
1025            param_type: "string".into(),
1026            required: false,
1027        },
1028    ]
1029}
1030
1031pub fn cloud_browse_params() -> Vec<ToolParam> {
1032    vec![
1033        ToolParam {
1034            name: "action".into(),
1035            description: "Action: 'detect' (find cloud folders, default) or 'list' (list files in a cloud folder).".into(),
1036            param_type: "string".into(),
1037            required: false,
1038        },
1039        ToolParam {
1040            name: "path".into(),
1041            description: "Path to list (required when action='list').".into(),
1042            param_type: "string".into(),
1043            required: false,
1044        },
1045    ]
1046}
1047
1048pub fn browser_cache_params() -> Vec<ToolParam> {
1049    vec![
1050        ToolParam {
1051            name: "action".into(),
1052            description: "Action: 'scan' (default) to report sizes or 'clean' to remove cache data.".into(),
1053            param_type: "string".into(),
1054            required: false,
1055        },
1056        ToolParam {
1057            name: "browser".into(),
1058            description: "Browser to target: 'chrome', 'firefox', 'safari', 'edge', 'arc', or 'all' (default).".into(),
1059            param_type: "string".into(),
1060            required: false,
1061        },
1062    ]
1063}
1064
1065pub fn screenshot_params() -> Vec<ToolParam> {
1066    vec![
1067        ToolParam {
1068            name: "path".into(),
1069            description: "Output file path (default 'screenshot.png').".into(),
1070            param_type: "string".into(),
1071            required: false,
1072        },
1073        ToolParam {
1074            name: "region".into(),
1075            description: "Capture region as 'x,y,width,height'. Omit for full screen.".into(),
1076            param_type: "string".into(),
1077            required: false,
1078        },
1079        ToolParam {
1080            name: "delay".into(),
1081            description: "Seconds to wait before capturing (default 0).".into(),
1082            param_type: "integer".into(),
1083            required: false,
1084        },
1085    ]
1086}
1087
1088pub fn clipboard_params() -> Vec<ToolParam> {
1089    vec![
1090        ToolParam {
1091            name: "action".into(),
1092            description: "Action: 'read' to get clipboard contents, 'write' to set them.".into(),
1093            param_type: "string".into(),
1094            required: true,
1095        },
1096        ToolParam {
1097            name: "content".into(),
1098            description: "Text to write to clipboard (required when action='write').".into(),
1099            param_type: "string".into(),
1100            required: false,
1101        },
1102    ]
1103}
1104
1105pub fn audit_sensitive_params() -> Vec<ToolParam> {
1106    vec![
1107        ToolParam {
1108            name: "path".into(),
1109            description: "Directory to scan for sensitive data (default '.').".into(),
1110            param_type: "string".into(),
1111            required: false,
1112        },
1113        ToolParam {
1114            name: "max_files".into(),
1115            description: "Maximum number of files to scan (default 500).".into(),
1116            param_type: "integer".into(),
1117            required: false,
1118        },
1119    ]
1120}
1121
1122pub fn secure_delete_params() -> Vec<ToolParam> {
1123    vec![
1124        ToolParam {
1125            name: "path".into(),
1126            description: "Path to the file or directory to securely delete.".into(),
1127            param_type: "string".into(),
1128            required: true,
1129        },
1130        ToolParam {
1131            name: "passes".into(),
1132            description: "Number of overwrite passes (default 3).".into(),
1133            param_type: "integer".into(),
1134            required: false,
1135        },
1136        ToolParam {
1137            name: "confirm".into(),
1138            description: "Must be true to proceed. First call without confirm returns file info.".into(),
1139            param_type: "boolean".into(),
1140            required: false,
1141        },
1142    ]
1143}
1144
1145pub fn summarize_file_params() -> Vec<ToolParam> {
1146    vec![
1147        ToolParam {
1148            name: "path".into(),
1149            description: "Path to the file to summarize.".into(),
1150            param_type: "string".into(),
1151            required: true,
1152        },
1153        ToolParam {
1154            name: "max_lines".into(),
1155            description: "Maximum lines for the head preview (default 50).".into(),
1156            param_type: "integer".into(),
1157            required: false,
1158        },
1159    ]
1160}
1161
1162pub fn ask_user_params() -> Vec<ToolParam> {
1163    vec![
1164        ToolParam {
1165            name: "prompt_type".into(),
1166            description: "The kind of input to request. One of: 'select' (pick one option), \
1167                          'multi_select' (pick multiple), 'confirm' (yes/no), \
1168                          'text' (free text input), 'form' (multiple named fields)."
1169                .into(),
1170            param_type: "string".into(),
1171            required: true,
1172        },
1173        ToolParam {
1174            name: "title".into(),
1175            description: "The question or instruction to show the user.".into(),
1176            param_type: "string".into(),
1177            required: true,
1178        },
1179        ToolParam {
1180            name: "description".into(),
1181            description: "Optional longer explanation shown below the title.".into(),
1182            param_type: "string".into(),
1183            required: false,
1184        },
1185        ToolParam {
1186            name: "options".into(),
1187            description: "Array of option objects for select/multi_select. \
1188                          Each object has 'label' (required), optional 'description', \
1189                          and optional 'value' (defaults to label). \
1190                          Example: [{\"label\":\"Option A\"},{\"label\":\"Option B\",\"description\":\"detailed\"}]"
1191                .into(),
1192            param_type: "array".into(),
1193            required: false,
1194        },
1195        ToolParam {
1196            name: "default_value".into(),
1197            description: "Default value: index for select (number), array of indices for \
1198                          multi_select, boolean for confirm, string for text."
1199                .into(),
1200            param_type: "string".into(),
1201            required: false,
1202        },
1203        ToolParam {
1204            name: "fields".into(),
1205            description: "Array of field objects for 'form' type. Each has 'name' (key), \
1206                          'label' (display), optional 'placeholder', optional 'default', \
1207                          and optional 'required' (boolean). \
1208                          Example: [{\"name\":\"host\",\"label\":\"Hostname\",\"required\":true}]"
1209                .into(),
1210            param_type: "array".into(),
1211            required: false,
1212        },
1213    ]
1214}
1215
1216// ── Sysadmin tools ──────────────────────────────────────────────────────────
1217
1218pub fn pkg_manage_params() -> Vec<ToolParam> {
1219    vec![
1220        ToolParam {
1221            name: "action".into(),
1222            description: "Action to perform: 'install', 'uninstall', 'upgrade', 'search', \
1223                          'list', 'info', 'detect'."
1224                .into(),
1225            param_type: "string".into(),
1226            required: true,
1227        },
1228        ToolParam {
1229            name: "package".into(),
1230            description: "Package name for install/uninstall/upgrade/search/info actions. \
1231                          For search, this is the query string."
1232                .into(),
1233            param_type: "string".into(),
1234            required: false,
1235        },
1236        ToolParam {
1237            name: "manager".into(),
1238            description: "Override auto-detected package manager (brew, apt, dnf, pacman, etc.). \
1239                          Omit to auto-detect."
1240                .into(),
1241            param_type: "string".into(),
1242            required: false,
1243        },
1244    ]
1245}
1246
1247pub fn net_info_params() -> Vec<ToolParam> {
1248    vec![
1249        ToolParam {
1250            name: "action".into(),
1251            description: "Action to perform: 'interfaces', 'connections', 'routing', 'dns', \
1252                          'ping', 'traceroute', 'whois', 'arp', 'public_ip', 'wifi', 'bandwidth'."
1253                .into(),
1254            param_type: "string".into(),
1255            required: true,
1256        },
1257        ToolParam {
1258            name: "target".into(),
1259            description: "Target host/IP for ping, traceroute, dns, whois. \
1260                          Filter string for connections."
1261                .into(),
1262            param_type: "string".into(),
1263            required: false,
1264        },
1265        ToolParam {
1266            name: "count".into(),
1267            description: "Number of pings to send (default: 4).".into(),
1268            param_type: "integer".into(),
1269            required: false,
1270        },
1271    ]
1272}
1273
1274pub fn net_scan_params() -> Vec<ToolParam> {
1275    vec![
1276        ToolParam {
1277            name: "action".into(),
1278            description: "Scan action: 'nmap', 'tcpdump', 'port_check', 'listen', \
1279                          'sniff', 'discover'."
1280                .into(),
1281            param_type: "string".into(),
1282            required: true,
1283        },
1284        ToolParam {
1285            name: "target".into(),
1286            description: "Target host/IP/subnet for nmap, port_check, discover. \
1287                          BPF filter expression for tcpdump."
1288                .into(),
1289            param_type: "string".into(),
1290            required: false,
1291        },
1292        ToolParam {
1293            name: "scan_type".into(),
1294            description: "nmap scan type: 'quick' (default), 'full', 'service', 'os', \
1295                          'udp', 'vuln', 'ping', 'stealth'."
1296                .into(),
1297            param_type: "string".into(),
1298            required: false,
1299        },
1300        ToolParam {
1301            name: "ports".into(),
1302            description: "Port range for nmap (e.g. '80,443' or '1-1024'). \
1303                          Single port for port_check."
1304                .into(),
1305            param_type: "string".into(),
1306            required: false,
1307        },
1308        ToolParam {
1309            name: "interface".into(),
1310            description: "Network interface for tcpdump/sniff (default: 'any').".into(),
1311            param_type: "string".into(),
1312            required: false,
1313        },
1314        ToolParam {
1315            name: "count".into(),
1316            description: "Number of packets to capture for tcpdump (default: 20).".into(),
1317            param_type: "integer".into(),
1318            required: false,
1319        },
1320        ToolParam {
1321            name: "seconds".into(),
1322            description: "Duration in seconds for sniff action (default: 5).".into(),
1323            param_type: "integer".into(),
1324            required: false,
1325        },
1326        ToolParam {
1327            name: "port".into(),
1328            description: "Single port number for port_check action.".into(),
1329            param_type: "integer".into(),
1330            required: false,
1331        },
1332    ]
1333}
1334
1335pub fn service_manage_params() -> Vec<ToolParam> {
1336    vec![
1337        ToolParam {
1338            name: "action".into(),
1339            description: "Action: 'list', 'status', 'start', 'stop', 'restart', \
1340                          'enable', 'disable', 'logs'."
1341                .into(),
1342            param_type: "string".into(),
1343            required: true,
1344        },
1345        ToolParam {
1346            name: "service".into(),
1347            description: "Service name for status/start/stop/restart/enable/disable/logs. \
1348                          Filter string for list."
1349                .into(),
1350            param_type: "string".into(),
1351            required: false,
1352        },
1353        ToolParam {
1354            name: "lines".into(),
1355            description: "Number of log lines to show (default: 50). Used with 'logs' action."
1356                .into(),
1357            param_type: "integer".into(),
1358            required: false,
1359        },
1360    ]
1361}
1362
1363pub fn user_manage_params() -> Vec<ToolParam> {
1364    vec![
1365        ToolParam {
1366            name: "action".into(),
1367            description: "Action: 'whoami', 'list_users', 'list_groups', 'user_info', \
1368                          'add_user', 'remove_user', 'add_to_group', 'last_logins'."
1369                .into(),
1370            param_type: "string".into(),
1371            required: true,
1372        },
1373        ToolParam {
1374            name: "name".into(),
1375            description: "Username for user_info, add_user, remove_user, add_to_group.".into(),
1376            param_type: "string".into(),
1377            required: false,
1378        },
1379        ToolParam {
1380            name: "group".into(),
1381            description: "Group name for add_to_group action.".into(),
1382            param_type: "string".into(),
1383            required: false,
1384        },
1385        ToolParam {
1386            name: "shell".into(),
1387            description: "Login shell for add_user (default: /bin/bash). Linux only.".into(),
1388            param_type: "string".into(),
1389            required: false,
1390        },
1391    ]
1392}
1393
1394pub fn firewall_params() -> Vec<ToolParam> {
1395    vec![
1396        ToolParam {
1397            name: "action".into(),
1398            description: "Action: 'status', 'rules', 'allow', 'deny', 'enable', 'disable'."
1399                .into(),
1400            param_type: "string".into(),
1401            required: true,
1402        },
1403        ToolParam {
1404            name: "port".into(),
1405            description: "Port number for allow/deny actions.".into(),
1406            param_type: "integer".into(),
1407            required: false,
1408        },
1409        ToolParam {
1410            name: "protocol".into(),
1411            description: "Protocol for allow/deny: 'tcp' (default) or 'udp'.".into(),
1412            param_type: "string".into(),
1413            required: false,
1414        },
1415    ]
1416}
1417
1418// ── Local model & environment tool params ───────────────────────────────────
1419
1420pub fn ollama_manage_params() -> Vec<ToolParam> {
1421    vec![
1422        ToolParam {
1423            name: "action".into(),
1424            description: "Action to perform: 'setup', 'serve', 'stop', 'status', 'pull', \
1425                          'rm', 'list', 'show', 'ps', 'load', 'unload', 'copy'."
1426                .into(),
1427            param_type: "string".into(),
1428            required: true,
1429        },
1430        ToolParam {
1431            name: "model".into(),
1432            description: "Model name for pull/rm/show/load/unload/copy \
1433                          (e.g. 'llama3.1', 'mistral:7b-instruct').".into(),
1434            param_type: "string".into(),
1435            required: false,
1436        },
1437        ToolParam {
1438            name: "destination".into(),
1439            description: "Destination tag for the 'copy' action.".into(),
1440            param_type: "string".into(),
1441            required: false,
1442        },
1443    ]
1444}
1445
1446pub fn exo_manage_params() -> Vec<ToolParam> {
1447    vec![
1448        ToolParam {
1449            name: "action".into(),
1450            description: "Action to perform: 'setup', 'start', 'stop', 'status', \
1451                          'models', 'state', 'downloads', 'preview', 'load', 'unload', 'update', 'log'."
1452                .into(),
1453            param_type: "string".into(),
1454            required: true,
1455        },
1456        ToolParam {
1457            name: "model".into(),
1458            description: "Model short ID for load/preview/unload \
1459                          (e.g. 'llama-3.2-1b', 'Qwen3-30B-A3B-4bit').".into(),
1460            param_type: "string".into(),
1461            required: false,
1462        },
1463        ToolParam {
1464            name: "instance_id".into(),
1465            description: "Instance ID for 'unload' action (from /state endpoint).".into(),
1466            param_type: "string".into(),
1467            required: false,
1468        },
1469        ToolParam {
1470            name: "port".into(),
1471            description: "API port for 'start' action (default: 52415).".into(),
1472            param_type: "integer".into(),
1473            required: false,
1474        },
1475        ToolParam {
1476            name: "no_worker".into(),
1477            description: "If true, start exo without worker (coordinator-only node).".into(),
1478            param_type: "boolean".into(),
1479            required: false,
1480        },
1481        ToolParam {
1482            name: "offline".into(),
1483            description: "If true, start in offline/air-gapped mode.".into(),
1484            param_type: "boolean".into(),
1485            required: false,
1486        },
1487        ToolParam {
1488            name: "verbose".into(),
1489            description: "If true, enable verbose logging for 'start'.".into(),
1490            param_type: "boolean".into(),
1491            required: false,
1492        },
1493    ]
1494}
1495
1496pub fn uv_manage_params() -> Vec<ToolParam> {
1497    vec![
1498        ToolParam {
1499            name: "action".into(),
1500            description: "Action to perform: 'setup', 'version', 'venv', 'pip-install', \
1501                          'pip-uninstall', 'pip-list', 'pip-freeze', 'sync', 'run', \
1502                          'python', 'init'."
1503                .into(),
1504            param_type: "string".into(),
1505            required: true,
1506        },
1507        ToolParam {
1508            name: "package".into(),
1509            description: "Single package name for pip-install/pip-uninstall.".into(),
1510            param_type: "string".into(),
1511            required: false,
1512        },
1513        ToolParam {
1514            name: "packages".into(),
1515            description: "Array of package names for pip-install/pip-uninstall.".into(),
1516            param_type: "array".into(),
1517            required: false,
1518        },
1519        ToolParam {
1520            name: "name".into(),
1521            description: "Name for venv (default '.venv') or init (project name).".into(),
1522            param_type: "string".into(),
1523            required: false,
1524        },
1525        ToolParam {
1526            name: "python".into(),
1527            description: "Python version specifier for venv (e.g. '3.12').".into(),
1528            param_type: "string".into(),
1529            required: false,
1530        },
1531        ToolParam {
1532            name: "version".into(),
1533            description: "Python version for 'python' action (e.g. '3.12', '3.11.6').".into(),
1534            param_type: "string".into(),
1535            required: false,
1536        },
1537        ToolParam {
1538            name: "command".into(),
1539            description: "Command string for 'run' action.".into(),
1540            param_type: "string".into(),
1541            required: false,
1542        },
1543        ToolParam {
1544            name: "file".into(),
1545            description: "Requirements file path for 'sync' action.".into(),
1546            param_type: "string".into(),
1547            required: false,
1548        },
1549    ]
1550}
1551
1552pub fn npm_manage_params() -> Vec<ToolParam> {
1553    vec![
1554        ToolParam {
1555            name: "action".into(),
1556            description: "Action to perform: 'setup', 'version', 'init', 'npm-install', \
1557                          'uninstall', 'list', 'outdated', 'update', 'run', 'start', \
1558                          'build', 'test', 'npx', 'audit', 'cache-clean', 'info', \
1559                          'search', 'status'."
1560                .into(),
1561            param_type: "string".into(),
1562            required: true,
1563        },
1564        ToolParam {
1565            name: "package".into(),
1566            description: "Single package name for install/uninstall/update/info.".into(),
1567            param_type: "string".into(),
1568            required: false,
1569        },
1570        ToolParam {
1571            name: "packages".into(),
1572            description: "Array of package names for install/uninstall.".into(),
1573            param_type: "array".into(),
1574            required: false,
1575        },
1576        ToolParam {
1577            name: "script".into(),
1578            description: "Script name for 'run' action (e.g. 'build', 'dev', 'start').".into(),
1579            param_type: "string".into(),
1580            required: false,
1581        },
1582        ToolParam {
1583            name: "command".into(),
1584            description: "Command string for 'npx' action (e.g. 'create-react-app my-app').".into(),
1585            param_type: "string".into(),
1586            required: false,
1587        },
1588        ToolParam {
1589            name: "query".into(),
1590            description: "Search query for 'search' action.".into(),
1591            param_type: "string".into(),
1592            required: false,
1593        },
1594        ToolParam {
1595            name: "dev".into(),
1596            description: "Install as devDependency (--save-dev). Default: false.".into(),
1597            param_type: "boolean".into(),
1598            required: false,
1599        },
1600        ToolParam {
1601            name: "global".into(),
1602            description: "Install/uninstall/list globally (-g). Default: false.".into(),
1603            param_type: "boolean".into(),
1604            required: false,
1605        },
1606        ToolParam {
1607            name: "depth".into(),
1608            description: "Depth for 'list' action. Default: 0.".into(),
1609            param_type: "integer".into(),
1610            required: false,
1611        },
1612        ToolParam {
1613            name: "fix".into(),
1614            description: "Run 'npm audit fix' instead of just 'npm audit'. Default: false.".into(),
1615            param_type: "boolean".into(),
1616            required: false,
1617        },
1618        ToolParam {
1619            name: "args".into(),
1620            description: "Extra arguments to pass after '--' when running scripts.".into(),
1621            param_type: "string".into(),
1622            required: false,
1623        },
1624    ]
1625}
1626
1627pub fn agent_setup_params() -> Vec<ToolParam> {
1628    vec![
1629        ToolParam {
1630            name: "components".into(),
1631            description: "Array of components to set up: 'uv', 'exo', 'ollama'. \
1632                          Defaults to all three if omitted."
1633                .into(),
1634            param_type: "array".into(),
1635            required: false,
1636        },
1637    ]
1638}