mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-24 10:16:59 -06:00
Merge PR #813
This commit is contained in:
@@ -167,6 +167,16 @@ fn tool_definitions_are_well_formed() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tools_that_write_files_are_not_read_only() {
|
||||
// `render_page` and `screenshot` write a file when given `path`, so they must not advertise `readOnlyHint: true`.
|
||||
for name in ["render_page", "screenshot", "export_png"] {
|
||||
let definition = tool_definitions().into_iter().find(|v| v["name"] == name).unwrap();
|
||||
assert!(definition["inputSchema"]["properties"].get("path").is_some(), "{name} takes a path");
|
||||
assert_eq!(definition["annotations"]["readOnlyHint"], false, "{name} writes files");
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- layout through the tools ----------
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -233,7 +233,7 @@ pub fn tool_definitions() -> Vec<Value> {
|
||||
}),
|
||||
&[],
|
||||
),
|
||||
true,
|
||||
false,
|
||||
),
|
||||
tool(
|
||||
"export_png",
|
||||
@@ -250,7 +250,7 @@ pub fn tool_definitions() -> Vec<Value> {
|
||||
"Screenshot",
|
||||
&app_only("Capture the whole app window (menus, panels, canvas) and return it as a PNG image. Optionally also keep it at `path`."),
|
||||
obj(json!({"path": string("Also write the PNG here")}), &[]),
|
||||
true,
|
||||
false,
|
||||
),
|
||||
// ----- input -----
|
||||
tool(
|
||||
|
||||
Reference in New Issue
Block a user