Class: Manceps::Tool

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

Overview

An MCP tool definition.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Tool

Returns a new instance of Tool.



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

def initialize(data)
  @name = data['name']
  @description = data['description']
  @title = data['title']
  @input_schema = data['inputSchema']
  @output_schema = data['outputSchema']
  @annotations = data['annotations']
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



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

def annotations
  @annotations
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#input_schemaObject (readonly)

Returns the value of attribute input_schema.



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

def input_schema
  @input_schema
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#output_schemaObject (readonly)

Returns the value of attribute output_schema.



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

def output_schema
  @output_schema
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
# File 'lib/manceps/tool.rb', line 17

def to_h
  h = { 'name' => name, 'description' => description, 'inputSchema' => input_schema }
  h['title'] = title if title
  h['outputSchema'] = output_schema if output_schema
  h
end