Skip to main content

vtcode_utility_tool_specs/
lib.rs

1//! Passive JSON schemas for utility, file, scheduling, and collaboration tool surfaces.
2
3#![recursion_limit = "256"]
4
5use serde_json::{Value, json};
6
7mod collaboration;
8mod json_schema;
9#[cfg(feature = "mcp")]
10mod mcp_tool;
11mod responses_api;
12
13pub use collaboration::{
14    close_agent_parameters, request_user_input_description, request_user_input_parameters,
15    resume_agent_parameters, send_input_parameters, spawn_agent_parameters,
16    spawn_background_subprocess_parameters, wait_agent_parameters,
17};
18pub use json_schema::{AdditionalProperties, JsonSchema, parse_tool_input_schema};
19#[cfg(feature = "mcp")]
20pub use mcp_tool::{ParsedMcpTool, parse_mcp_tool};
21pub use responses_api::{FreeformTool, FreeformToolFormat, ResponsesApiTool};
22
23pub const SEMANTIC_ANCHOR_GUIDANCE: &str =
24    "Prefer stable semantic @@ anchors such as function, class, method, or impl names.";
25pub const APPLY_PATCH_ALIAS_DESCRIPTION: &str = "Alias for input";
26pub const DEFAULT_APPLY_PATCH_INPUT_DESCRIPTION: &str = "Patch in VT Code format: *** Begin Patch, *** Update File: path, @@ hunk, -/+ lines, *** End Patch";
27
28#[must_use]
29pub fn with_semantic_anchor_guidance(base: &str) -> String {
30    let trimmed = base.trim_end();
31    if trimmed.contains(SEMANTIC_ANCHOR_GUIDANCE) {
32        trimmed.to_string()
33    } else if trimmed.ends_with('.') {
34        format!("{trimmed} {SEMANTIC_ANCHOR_GUIDANCE}")
35    } else {
36        format!("{trimmed}. {SEMANTIC_ANCHOR_GUIDANCE}")
37    }
38}
39
40#[must_use]
41pub fn apply_patch_parameter_schema(input_description: &str) -> Value {
42    json!({
43        "type": "object",
44        "properties": {
45            "input": {
46                "type": "string",
47                "description": with_semantic_anchor_guidance(input_description)
48            },
49            "patch": {
50                "type": "string",
51                "description": APPLY_PATCH_ALIAS_DESCRIPTION
52            }
53        },
54        "anyOf": [
55            {"required": ["input"]},
56            {"required": ["patch"]}
57        ]
58    })
59}
60
61#[must_use]
62pub fn apply_patch_parameters() -> Value {
63    apply_patch_parameter_schema(DEFAULT_APPLY_PATCH_INPUT_DESCRIPTION)
64}
65
66#[must_use]
67pub fn cron_create_parameters() -> Value {
68    json!({
69        "type": "object",
70        "required": ["prompt"],
71        "additionalProperties": false,
72        "properties": {
73            "prompt": {"type": "string", "description": "Prompt to run when the task fires."},
74            "name": {"type": "string", "description": "Optional short label for the task."},
75            "cron": {"type": "string", "description": "Five-field cron expression for recurring tasks."},
76            "delay_minutes": {"type": "integer", "description": "Fixed recurring interval in minutes."},
77            "run_at": {
78                "type": "string",
79                "description": "One-shot fire time in RFC3339 or local datetime form. Use this instead of `cron` or `delay_minutes` for reminders."
80            }
81        }
82    })
83}
84
85#[must_use]
86pub fn cron_list_parameters() -> Value {
87    json!({
88        "type": "object",
89        "properties": {},
90        "additionalProperties": false
91    })
92}
93
94#[must_use]
95pub fn cron_delete_parameters() -> Value {
96    json!({
97        "type": "object",
98        "required": ["id"],
99        "properties": {
100            "id": {"type": "string", "description": "Session scheduled task id to delete."}
101        }
102    })
103}
104
105#[must_use]
106pub fn unified_exec_parameters() -> Value {
107    json!({
108        "type": "object",
109        "properties": {
110            "command": {
111                "description": "Command as a shell string or argv array.",
112                "anyOf": [
113                    {"type": "string"},
114                    {
115                        "type": "array",
116                        "items": {"type": "string"}
117                    }
118                ]
119            },
120            "input": {"type": "string", "description": "stdin for write or continue."},
121            "session_id": {"type": "string", "description": "Session id. Compact alias: `s`."},
122            "spool_path": {"type": "string", "description": "Spool path for inspect."},
123            "query": {"type": "string", "description": "Line filter for inspect or run output."},
124            "head_lines": {"type": "integer", "description": "Head preview lines."},
125            "tail_lines": {"type": "integer", "description": "Tail preview lines."},
126            "max_matches": {"type": "integer", "description": "Max filtered matches.", "default": 200},
127            "literal": {"type": "boolean", "description": "Treat query as literal text.", "default": false},
128            "code": {"type": "string", "description": "Raw Python or JavaScript source for `action=code`. Send the source directly, not JSON or markdown fences."},
129            "language": {
130                "type": "string",
131                "enum": ["python3", "javascript"],
132                "description": "Language for `action=code`. Defaults to `python3`; set `javascript` to run Node-based code execution instead.",
133                "default": "python3"
134            },
135            "action": {
136                "type": "string",
137                "enum": ["run", "write", "poll", "continue", "inspect", "list", "close", "code"],
138                "description": "Optional; inferred from command/code/input/session_id/spool_path. Use `code` to run a fresh Python or JavaScript snippet through the local code executor."
139            },
140            "workdir": {"type": "string", "description": "Working directory. Alias: cwd."},
141            "tty": {"type": "boolean", "description": "Use PTY mode.", "default": false},
142            "shell": {"type": "string", "description": "Shell binary."},
143            "login": {"type": "boolean", "description": "Use a login shell.", "default": false},
144            "sandbox_permissions": {
145                "type": "string",
146                "enum": ["use_default", "with_additional_permissions", "require_escalated"],
147                "description": "Sandbox policy. Use `require_escalated` only when needed."
148            },
149            "additional_permissions": {
150                "type": "object",
151                "description": "Extra sandboxed filesystem access.",
152                "properties": {
153                    "fs_read": {
154                        "type": "array",
155                        "items": {"type": "string"},
156                        "description": "Extra readable paths."
157                    },
158                    "fs_write": {
159                        "type": "array",
160                        "items": {"type": "string"},
161                        "description": "Extra writable paths."
162                    }
163                },
164                "additionalProperties": false
165            },
166            "justification": {"type": "string", "description": "Approval question for `require_escalated`."},
167            "prefix_rule": {
168                "type": "array",
169                "items": {"type": "string"},
170                "description": "Optional persisted approval prefix for `command`."
171            },
172            "timeout_secs": {"type": "integer", "description": "Timeout seconds.", "default": 180},
173            "yield_time_ms": {"type": "integer", "description": "Wait before returning output (ms).", "default": 1000},
174            "confirm": {"type": "boolean", "description": "Confirm destructive ops.", "default": false},
175            "max_output_tokens": {"type": "integer", "description": "Output token cap."},
176            "track_files": {"type": "boolean", "description": "Track file changes.", "default": false}
177        }
178    })
179}
180
181#[must_use]
182pub fn unified_file_parameters() -> Value {
183    json!({
184        "type": "object",
185        "properties": {
186            "action": {
187                "type": "string",
188                "enum": ["read", "write", "edit", "patch", "delete", "move", "copy"],
189                "description": "Optional; inferred from old_str/patch/content/destination/path."
190            },
191            "path": {"type": "string", "description": "File path. Accepts file_path/filepath/target_path/file/p."},
192            "content": {"type": "string", "description": "Content for write."},
193            "old_str": {"type": "string", "description": "Exact text to replace for edit."},
194            "new_str": {"type": "string", "description": "Replacement text for edit."},
195            "patch": {"type": "string", "description": "Patch text in `*** Update File:` format, not unified diff."},
196            "destination": {"type": "string", "description": "Destination for move or copy."},
197            "offset": {"type": "integer", "description": "Read start line (1-indexed). Compact alias: `o`."},
198            "limit": {"type": "integer", "description": "Read line count. Compact alias: `l`."},
199            "mode": {"type": "string", "description": "Read mode or write mode.", "default": "slice"},
200            "condense": {"type": "boolean", "description": "Condense long output to head/tail. Set false for full content.", "default": true},
201            "raw": {"type": "boolean", "description": "Bypass output spooling and return full content inline. Use when you need exact file content without spooling to disk.", "default": false},
202            "indentation": {
203                "description": "Indentation config. `true` uses defaults.",
204                "anyOf": [
205                    {"type": "boolean"},
206                    {
207                        "type": "object",
208                        "properties": {
209                            "anchor_line": {"type": "integer", "description": "Anchor line; defaults to offset."},
210                            "max_levels": {"type": "integer", "description": "Indent depth cap; 0 means unlimited."},
211                            "include_siblings": {"type": "boolean", "description": "Include sibling blocks."},
212                            "include_header": {"type": "boolean", "description": "Include header lines."},
213                            "max_lines": {"type": "integer", "description": "Optional line cap."}
214                        },
215                        "additionalProperties": false
216                    }
217                ]
218            }
219        }
220    })
221}
222
223#[must_use]
224pub fn read_file_parameters() -> Value {
225    json!({
226        "type": "object",
227        "properties": {
228            "path": {"type": "string", "description": "File path. Accepts file_path/filepath/target_path/file/p."},
229            "offset": {"type": "integer", "description": "1-indexed line offset. Compact alias: `o`.", "minimum": 1},
230            "limit": {"type": "integer", "description": "Max lines for this chunk. Compact alias: `l`.", "minimum": 1},
231            "mode": {"type": "string", "enum": ["slice", "indentation"], "description": "Read mode.", "default": "slice"},
232            "indentation": {
233                "description": "Indentation-aware block selection.",
234                "anyOf": [
235                    {"type": "boolean"},
236                    {
237                        "type": "object",
238                        "properties": {
239                            "anchor_line": {"type": "integer", "description": "Anchor line; defaults to offset."},
240                            "max_levels": {"type": "integer", "description": "Indent depth cap; 0 means unlimited."},
241                            "include_siblings": {"type": "boolean", "description": "Include sibling blocks."},
242                            "include_header": {"type": "boolean", "description": "Include header lines."},
243                            "max_lines": {"type": "integer", "description": "Optional line cap."}
244                        },
245                        "additionalProperties": false
246                    }
247                ]
248            },
249            "offset_lines": {"type": "integer", "description": "Legacy alias for line offset.", "minimum": 1},
250            "page_size_lines": {"type": "integer", "description": "Legacy alias for line chunk size.", "minimum": 1},
251            "offset_bytes": {"type": "integer", "description": "Byte offset for binary or byte-paged reads.", "minimum": 0},
252            "page_size_bytes": {"type": "integer", "description": "Byte page size for binary or byte-paged reads.", "minimum": 1},
253            "max_bytes": {"type": "integer", "description": "Maximum bytes to return.", "minimum": 1},
254            "max_lines": {"type": "integer", "description": "Maximum lines to return in legacy mode.", "minimum": 1},
255            "chunk_lines": {"type": "integer", "description": "Legacy alias for chunk size in lines.", "minimum": 1},
256            "max_tokens": {"type": "integer", "description": "Optional token budget for large reads.", "minimum": 1},
257            "condense": {"type": "boolean", "description": "Condense long outputs to head/tail. Set false for full content.", "default": true}
258        }
259    })
260}
261
262#[must_use]
263pub fn unified_search_parameters() -> Value {
264    json!({
265        "type": "object",
266        "properties": {
267            "action": {
268                "type": "string",
269                "enum": ["grep", "list", "structural", "tools", "errors", "agent", "web", "skill"],
270                "description": "Search action: grep (text), list (files), structural (ast-grep), tools, errors, agent, web, skill."
271            },
272            "workflow": {
273                "type": "string",
274                "enum": ["query", "scan", "test", "rewrite", "new", "apply"],
275                "description": "Structural workflow: query (search), scan (config rules), test (rule tests), rewrite (preview), apply (write), new (scaffold).",
276                "default": "query"
277            },
278            "pattern": {"type": "string", "description": "For grep: regex/literal. For list: glob filter. For structural: ast-grep pattern ($VAR=node, $$$ARGS=many). At least one of pattern or kind required for structural query."},
279            "kind": {"type": "string", "description": "Ast-grep node kind (e.g. function_item, call_expression). Supports >, +, ~, :has(), :not() selectors. Use alone or with pattern."},
280            "path": {"type": "string", "description": "Directory or file path to search in. Used by `grep`, `list`, and structural `workflow=\"query\"|\"scan\"`. Public structural calls take one root per request even though raw ast-grep `run` can accept multiple paths.", "default": "."},
281            "config_path": {"type": "string", "description": "Ast-grep config path for structural `workflow=\"scan\"` or `workflow=\"test\"`. Defaults to workspace `sgconfig.yml`."},
282            "filter": {"type": "string", "description": "Ast-grep rule or test filter for structural `workflow=\"scan\"` or `workflow=\"test\"`. On `scan`, this maps to `--filter` over rule ids from config."},
283            "lang": {"type": "string", "description": "Language for structural `workflow=\"query\"` or `workflow=\"rewrite\"`. Set it whenever the code language is known; required for debug_query and recommended for rewrite."},
284            "selector": {"type": "string", "description": "Ast-grep selector when match is a subnode. Supports :has(), :not(), :is(), :nth-child()."},
285            "strictness": {
286                "type": "string",
287                "enum": ["cst", "smart", "ast", "relaxed", "signature", "template"],
288                "description": "Pattern strictness for structural `workflow=\"query\"`."
289            },
290            "debug_query": {
291                "type": "string",
292                "enum": ["pattern", "ast", "cst", "sexp"],
293                "description": "Print the structural query AST instead of matches for `workflow=\"query\"`. Requires lang."
294            },
295            "globs": {
296                "description": "Optional include/exclude globs for structural `workflow=\"query\"` or `workflow=\"scan\"`. Maps to repeated ast-grep `--globs` flags.",
297                "anyOf": [
298                    {"type": "string"},
299                    {"type": "array", "items": {"type": "string"}}
300                ]
301            },
302            "skip_snapshot_tests": {"type": "boolean", "description": "Skip ast-grep snapshot tests for structural `workflow=\"test\"`.", "default": false},
303            "rewrite": {"type": "string", "description": "Replacement string for structural `workflow=\"rewrite\"`. Meta variables from `pattern` can be referenced (e.g. `$VAR`, `$$$ARGS`). For simple pattern-to-pattern rewrites. Either `rewrite` or `fix_config` is required for `workflow=\"rewrite\"`."},
304            "fix_config": {
305                "type": "object",
306                "description": "Advanced fix configuration for structural `workflow=\"rewrite\"`. Use when replacing only the matched node is not enough, especially for deleting list items or key-value pairs that also need a surrounding comma removed. Either `rewrite` or `fix_config` is required for `workflow=\"rewrite\"`.",
307                "properties": {
308                    "template": {"type": "string", "description": "Replacement template string. Meta variables from `pattern` can be referenced."},
309                    "expand_start": {
310                        "type": "object",
311                        "description": "Expand fix range start backwards. Requires at least one of: regex, kind, pattern.",
312                        "properties": {
313                            "regex": {"type": "string", "description": "Regex to match node text."},
314                            "kind": {"type": "string", "description": "Tree-sitter node kind."},
315                            "pattern": {"type": "string", "description": "Ast-grep pattern."},
316                            "stop_by": {"description": "Expansion stop rule. String (\"line\"|\"end\") or rule object."}
317                        }
318                    },
319                    "expand_end": {
320                        "type": "object",
321                        "description": "Expand fix range end forwards. Requires at least one of: regex, kind, pattern.",
322                        "properties": {
323                            "regex": {"type": "string", "description": "Regex to match node text."},
324                            "kind": {"type": "string", "description": "Tree-sitter node kind."},
325                            "pattern": {"type": "string", "description": "Ast-grep pattern."},
326                            "stop_by": {"description": "Expansion stop rule. String (\"line\"|\"end\") or rule object."}
327                        }
328                    }
329                },
330                "required": ["template"]
331            },
332            "new_subcommand": {"type": "string", "enum": ["project", "rule", "test", "util"], "description": "Subcommand for structural `workflow=\"new\"`. `project` scaffolds sgconfig.yml and directories; `rule` creates a new rule YAML; `test` creates a new test YAML; `util` creates a new utility rule."},
333            "new_name": {"type": "string", "description": "Name for the new rule, test, or utility. Required for `new` subcommands `rule`, `test`, and `util`."},
334            "keyword": {"type": "string", "description": "Keyword for 'tools' search."},
335            "url": {"type": "string", "format": "uri", "description": "The URL to fetch content from (for 'web' action)."},
336            "prompt": {"type": "string", "description": "The prompt to run on the fetched content (for 'web' action)."},
337            "name": {"type": "string", "description": "Skill name to load (for 'skill' action)."},
338            "detail_level": {
339                "type": "string",
340                "enum": ["name-only", "name-and-description", "full"],
341                "description": "Detail level for 'tools' action.",
342                "default": "name-and-description"
343            },
344            "mode": {
345                "type": "string",
346                "description": "Mode for 'list' (list|recursive|tree|etc) or 'agent' (debug|analyze|full) action.",
347                "default": "list"
348            },
349            "max_results": {"type": "integer", "description": "Max results to return.", "default": 100},
350            "case_sensitive": {"type": "boolean", "description": "Case-sensitive search.", "default": false},
351            "context_lines": {"type": "integer", "description": "Context lines for `grep` or structural `workflow=\"query\"|\"scan\"` results. Structural maps this to ast-grep `--context`; raw `--before` and `--after` are not exposed separately.", "default": 0},
352            "severities": {
353                "type": "array",
354                "items": {"type": "string", "enum": ["error", "warning", "info", "hint"]},
355                "description": "Post-run severity filter for structural `workflow=\"scan\"`. When present, only findings matching one of the listed severities are returned. Does not override rule severities at the CLI level."
356            },
357            "no_ignore": {
358                "type": "array",
359                "items": {"type": "string", "enum": ["hidden", "dot", "exclude", "global", "parent", "vcs"]},
360                "description": "Ignore file overrides: hidden, dot, exclude, global, parent, vcs."
361            },
362            "follow": {"type": "boolean", "description": "Follow symbolic links while traversing directories for structural workflows.", "default": false},
363            "threads": {"type": "integer", "description": "Number of threads for ast-grep scan parallelism. 0 means auto. Only for `workflow=\"scan\"`.", "minimum": 0, "maximum": 256, "default": 0},
364            "format": {"type": "string", "enum": ["github", "sarif"], "description": "Output format for CI pipelines for structural `workflow=\"scan\"`. When set, returns raw formatted output instead of normalized JSON."},
365            "report_style": {"type": "string", "enum": ["rich", "medium", "short"], "description": "Diagnostic report style for structural `workflow=\"scan\"`. Controls verbosity of diagnostic output."},
366            "before_lines": {"type": "integer", "description": "Context lines before each match for structural workflows. Mutually exclusive with `context_lines`.", "minimum": 0, "maximum": 20},
367            "after_lines": {"type": "integer", "description": "Context lines after each match for structural workflows. Mutually exclusive with `context_lines`.", "minimum": 0, "maximum": 20},
368            "builtin_rules": {
369                "type": "array",
370                "items": {"type": "string"},
371                "description": "Built-in ast-grep rules to activate for `workflow=\"scan\"`. Valid values: `unused-suppression` (reports stale ignore directives), `no-suppress-all` (reports suppress-all comments). Use `\"rule:severity\"` format to set severity (e.g. `\"unused-suppression:error\"`). Default severity is hint."
372            },
373            "scope": {"type": "string", "description": "Scope for 'errors' action (archive|all).", "default": "archive"},
374            "max_bytes": {"type": "integer", "description": "Maximum bytes to fetch for 'web' action.", "default": 500000},
375            "timeout_secs": {"type": "integer", "description": "Timeout in seconds.", "default": 30}
376        }
377    })
378}
379
380#[must_use]
381pub fn list_files_parameters() -> Value {
382    json!({
383        "type": "object",
384        "properties": {
385            "path": {"type": "string", "description": "Directory or file path to inspect.", "default": "."},
386            "mode": {
387                "type": "string",
388                "enum": ["list", "recursive", "tree", "find_name", "find_content", "largest", "file", "files"],
389                "description": "Listing mode. Use page/per_page to continue paginated results.",
390                "default": "list"
391            },
392            "pattern": {"type": "string", "description": "Optional glob-style path filter."},
393            "name_pattern": {"type": "string", "description": "Optional name filter for list/find_name modes."},
394            "content_pattern": {"type": "string", "description": "Content query for find_content mode."},
395            "page": {"type": "integer", "description": "1-indexed results page.", "minimum": 1},
396            "per_page": {"type": "integer", "description": "Items per page.", "minimum": 1},
397            "max_results": {"type": "integer", "description": "Maximum total results to consider before pagination.", "minimum": 1},
398            "include_hidden": {"type": "boolean", "description": "Include dotfiles and hidden entries.", "default": false},
399            "response_format": {"type": "string", "enum": ["concise", "detailed"], "description": "Verbosity of the listing output.", "default": "concise"},
400            "case_sensitive": {"type": "boolean", "description": "Case-sensitive name matching.", "default": false}
401        }
402    })
403}
404
405#[cfg(test)]
406mod tests {
407    use super::*;
408    use serde_json::json;
409
410    #[test]
411    fn apply_patch_parameter_schema_keeps_alias_and_guidance_consistent() {
412        let schema = apply_patch_parameter_schema("Patch in VT Code format");
413
414        assert_eq!(
415            schema["properties"]["patch"]["description"],
416            APPLY_PATCH_ALIAS_DESCRIPTION
417        );
418        let input_description = schema["properties"]["input"]["description"]
419            .as_str()
420            .expect("input description");
421        assert!(input_description.contains(SEMANTIC_ANCHOR_GUIDANCE));
422    }
423
424    #[test]
425    fn unified_exec_schema_accepts_string_or_array_commands() {
426        let params = unified_exec_parameters();
427        let command = &params["properties"]["command"];
428        let variants = command["anyOf"].as_array().expect("command anyOf");
429
430        assert_eq!(variants.len(), 2);
431        assert_eq!(variants[0]["type"], "string");
432        assert_eq!(variants[1]["type"], "array");
433        assert_eq!(variants[1]["items"]["type"], "string");
434        assert_eq!(params["properties"]["tty"]["type"], "boolean");
435        assert_eq!(params["properties"]["tty"]["default"], false);
436        assert!(
437            params["properties"]["code"]["description"]
438                .as_str()
439                .expect("code description")
440                .contains("Raw Python or JavaScript source")
441        );
442        assert!(
443            params["properties"]["language"]["description"]
444                .as_str()
445                .expect("language description")
446                .contains("set `javascript`")
447        );
448    }
449
450    #[test]
451    fn unified_search_schema_advertises_structural_and_hides_intelligence() {
452        let params = unified_search_parameters();
453        let actions = params["properties"]["action"]["enum"]
454            .as_array()
455            .expect("action enum");
456
457        assert!(actions.iter().any(|value| value == "structural"));
458        assert!(!actions.iter().any(|value| value == "intelligence"));
459        assert!(
460            params["properties"]["debug_query"]["enum"]
461                .as_array()
462                .expect("debug_query enum")
463                .iter()
464                .any(|value| value == "ast")
465        );
466        assert!(
467            params["properties"]["action"]["description"]
468                .as_str()
469                .expect("action description")
470                .contains("structural")
471        );
472        assert!(
473            params["properties"]["pattern"]["description"]
474                .as_str()
475                .expect("pattern description")
476                .contains("ast-grep pattern")
477        );
478        assert!(
479            params["properties"]["pattern"]["description"]
480                .as_str()
481                .expect("pattern description")
482                .contains("$$$ARGS")
483        );
484        assert!(
485            params["properties"]["pattern"]["description"]
486                .as_str()
487                .expect("pattern description")
488                .contains("glob filter")
489        );
490        assert!(
491            params["properties"]["action"]["description"]
492                .as_str()
493                .expect("action description")
494                .contains("grep")
495        );
496        assert_eq!(params["properties"]["workflow"]["enum"][1], "scan");
497        assert_eq!(params["properties"]["workflow"]["enum"][2], "test");
498        assert!(
499            params["properties"]["config_path"]["description"]
500                .as_str()
501                .expect("config path description")
502                .contains("Defaults to workspace `sgconfig.yml`")
503        );
504        assert!(
505            params["properties"]["skip_snapshot_tests"]["description"]
506                .as_str()
507                .expect("skip snapshot description")
508                .contains("workflow=\"test\"")
509        );
510    }
511
512    #[test]
513    fn legacy_browse_tool_schemas_expose_chunking_and_pagination_fields() {
514        let read_params = read_file_parameters();
515        assert!(read_params["properties"]["offset"].is_object());
516        assert!(read_params["properties"]["limit"].is_object());
517        assert!(read_params["properties"]["page_size_lines"].is_object());
518
519        let list_params = list_files_parameters();
520        assert!(list_params["properties"]["page"].is_object());
521        assert!(list_params["properties"]["per_page"].is_object());
522        assert!(
523            list_params["properties"]["mode"]["enum"]
524                .as_array()
525                .expect("mode enum")
526                .iter()
527                .any(|value| value == "recursive")
528        );
529    }
530
531    #[test]
532    fn semantic_anchor_guidance_is_appended_once() {
533        let base = "Patch in VT Code format.";
534        let with_guidance = with_semantic_anchor_guidance(base);
535
536        assert!(with_guidance.contains(SEMANTIC_ANCHOR_GUIDANCE));
537        assert_eq!(with_semantic_anchor_guidance(&with_guidance), with_guidance);
538    }
539
540    #[test]
541    fn default_apply_patch_parameters_keep_expected_alias_shape() {
542        let schema = apply_patch_parameters();
543
544        assert_eq!(
545            schema["anyOf"],
546            json!([
547                {"required": ["input"]},
548                {"required": ["patch"]}
549            ])
550        );
551    }
552}