Class: MCP::Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/mcp/annotations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audience: nil, priority: nil, last_modified: nil) ⇒ Annotations

Returns a new instance of Annotations.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# File 'lib/mcp/annotations.rb', line 7

def initialize(audience: nil, priority: nil, last_modified: nil)
  raise ArgumentError, "The value of priority must be between 0 and 1." if priority && !priority.between?(0, 1)

  @audience = audience
  @priority = priority
  @last_modified = last_modified
end

Instance Attribute Details

#audienceObject (readonly)

Returns the value of attribute audience.



5
6
7
# File 'lib/mcp/annotations.rb', line 5

def audience
  @audience
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



5
6
7
# File 'lib/mcp/annotations.rb', line 5

def last_modified
  @last_modified
end

#priorityObject (readonly)

Returns the value of attribute priority.



5
6
7
# File 'lib/mcp/annotations.rb', line 5

def priority
  @priority
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
# File 'lib/mcp/annotations.rb', line 15

def to_h
  {
    audience: audience,
    priority: priority,
    lastModified: last_modified,
  }.compact
end