fix: read scope for listing mcp tools

Also fixes the image viewer size after two changes crossed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-28 19:25:42 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent dde36c1682
commit 8ccb60c711
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -251,6 +251,11 @@ fn map_http_method_to_action(method: &str, route_path: &str) -> ScopeAction {
return ScopeAction::Run;
}
// Lists a resource's tools; a POST only so that a navigation cannot reach it.
if method.eq_ignore_ascii_case("POST") && route_path.contains("/resources/mcp_tools/") {
return ScopeAction::Read;
}
match method.to_uppercase().as_str() {
"GET" | "HEAD" | "OPTIONS" => ScopeAction::Read,
"POST" | "PUT" | "PATCH" | "DELETE" => ScopeAction::Write,
@@ -130,8 +130,8 @@
/** The displayed image as PNG bytes, drawn through a canvas. */
function rasterize(): Promise<Blob> {
const canvas = document.createElement('canvas')
canvas.width = natural?.w ?? imgEl!.naturalWidth
canvas.height = natural?.h ?? imgEl!.naturalHeight
canvas.width = view.natural?.w ?? imgEl!.naturalWidth
canvas.height = view.natural?.h ?? imgEl!.naturalHeight
canvas.getContext('2d')!.drawImage(imgEl!, 0, 0, canvas.width, canvas.height)
return new Promise<Blob>((resolve, reject) =>
canvas.toBlob((b) => (b ? resolve(b) : reject(new Error('encoding failed'))), 'image/png')