From 0820ef857c94e3259a4104d0d14fcaed2463167d Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Tue, 13 Oct 2026 18:17:59 +0200 Subject: [PATCH] MCP: render_page and screenshot are not read-only because they can write to path (#733) --- crates/mcp/src/tests.rs | 10 ++++++++++ crates/mcp/src/tools.rs | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 3051a5ad4..0f3cdd56c 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -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] diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index c51bac8ed..88c3a6097 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -232,7 +232,7 @@ pub fn tool_definitions() -> Vec { }), &[], ), - true, + false, ), tool( "export_png", @@ -249,7 +249,7 @@ pub fn tool_definitions() -> Vec { "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(