Skip to content

Commit eb1c939

Browse files
committed
Make description and mime_type optional keyword arguments in Resource
This change is related to #29. According to the specification, both `description` and `mimeType` of Resource are optional: https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource Therefore, it makes sense to treat them as optional keyword arguments, similar to how this is done in `ResourceTemplate`: https://github.com/modelcontextprotocol/ruby-sdk/blob/0b49c3/lib/mcp/resource_template.rb#L8 As additional context, the TypeScript SDK also treats them as optional. https://github.com/modelcontextprotocol/typescript-sdk/blob/1.12.1/src/types.ts#L438-L466
1 parent 91219d3 commit eb1c939

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mcp/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module MCP
55
class Resource
66
attr_reader :uri, :name, :description, :mime_type
77

8-
def initialize(uri:, name:, description:, mime_type:)
8+
def initialize(uri:, name:, description: nil, mime_type: nil)
99
@uri = uri
1010
@name = name
1111
@description = description

0 commit comments

Comments
 (0)