- fix `lib/mcp-ruby` auto-import path - implement server resources - add basic listing of resources to Server - allow setting handlers on Server - wrap handler method results - make tool definition more declarative - make prompt definition more declarative - bump dependency versions
26 lines
554 B
Ruby
26 lines
554 B
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
module ModelContextProtocol
|
|
class Resource
|
|
attr_reader :uri, :name, :description, :mime_type, :contents
|
|
|
|
def initialize(uri:, name:, description:, mime_type:, contents:)
|
|
@uri = uri
|
|
@name = name
|
|
@description = description
|
|
@mime_type = mime_type
|
|
@contents = contents
|
|
end
|
|
|
|
def to_h
|
|
{
|
|
uri: @uri,
|
|
name: @name,
|
|
description: @description,
|
|
mimeType: @mime_type,
|
|
contents: @contents.map(&:to_h),
|
|
}
|
|
end
|
|
end
|
|
end
|