This PR moves `MCP::Annotations` from lib/mcp.rb to lib/mcp/annotations.rb for better organization, following the pattern used for other classes such as `Tool::Annotations`. This PR also adds the missing `last_modified` attribute to `MCP::Annotations`: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.ts#L1701-L1736 It also adds a `to_h` method for serialization and includes comprehensive test coverage. NOTE: This code is unused within the ruby-sdk repository, but it is kept for compatibility, as it may be used by users.
21 lines
433 B
Ruby
21 lines
433 B
Ruby
# frozen_string_literal: true
|
|
|
|
module MCP
|
|
class Annotations
|
|
attr_reader :audience, :priority, :last_modified
|
|
|
|
def initialize(audience: nil, priority: nil, last_modified: nil)
|
|
@audience = audience
|
|
@priority = priority
|
|
@last_modified = last_modified
|
|
end
|
|
|
|
def to_h
|
|
{
|
|
audience: audience,
|
|
priority: priority,
|
|
lastModified: last_modified,
|
|
}.compact
|
|
end
|
|
end
|
|
end
|