Class: RubyLLM::MCP::Annotation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(annotation) ⇒ Annotation

Returns a new instance of Annotation.



8
9
10
11
12
13
14
# File 'lib/ruby_llm/mcp/tool.rb', line 8

def initialize(annotation)
  @title = annotation["title"] || ""
  @read_only_hint = annotation["readOnlyHint"] || false
  @destructive_hint = annotation.fetch("destructiveHint", true)
  @idempotent_hint = annotation["idempotentHint"] || false
  @open_world_hint = annotation.fetch("openWorldHint", true)
end

Instance Attribute Details

#destructive_hintObject (readonly)

Returns the value of attribute destructive_hint.



6
7
8
# File 'lib/ruby_llm/mcp/tool.rb', line 6

def destructive_hint
  @destructive_hint
end

#idempotent_hintObject (readonly)

Returns the value of attribute idempotent_hint.



6
7
8
# File 'lib/ruby_llm/mcp/tool.rb', line 6

def idempotent_hint
  @idempotent_hint
end

#open_world_hintObject (readonly)

Returns the value of attribute open_world_hint.



6
7
8
# File 'lib/ruby_llm/mcp/tool.rb', line 6

def open_world_hint
  @open_world_hint
end

#read_only_hintObject (readonly)

Returns the value of attribute read_only_hint.



6
7
8
# File 'lib/ruby_llm/mcp/tool.rb', line 6

def read_only_hint
  @read_only_hint
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/ruby_llm/mcp/tool.rb', line 6

def title
  @title
end

Instance Method Details

#to_hObject



16
17
18
19
20
21
22
23
24
# File 'lib/ruby_llm/mcp/tool.rb', line 16

def to_h
  {
    title: @title,
    readOnlyHint: @read_only_hint,
    destructiveHint: @destructive_hint,
    idempotentHint: @idempotent_hint,
    openWorldHint: @open_world_hint
  }
end