From 2f354a872aae2026beba08c3cb8c6891f25a1ee0 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Thu, 29 May 2025 02:04:08 +0900 Subject: [PATCH] Suppress redundant attributes in Resources According to the specification, the following attributes are optional, so using `compact` ensures consistency. - `description`: Optional description - `mimeType`: Optional MIME type - `size`: Optional size in bytes https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource --- lib/mcp/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mcp/resource.rb b/lib/mcp/resource.rb index 5b985a93..6c92ce00 100644 --- a/lib/mcp/resource.rb +++ b/lib/mcp/resource.rb @@ -18,7 +18,7 @@ def to_h name: @name, description: @description, mimeType: @mime_type, - } + }.compact end end end