Class: ReadTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/exe.rb

Overview

readツールの定義

Class Method Summary collapse

Class Method Details

.call(name:) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/exe.rb', line 20

def self.call(name:)
  # 名前が文字列でない場合
  return MCP::Tool::Response.new([{ type: "text", text: "Name must be a string" }]) unless name.is_a?(String)

  # Vaultからノートを読み取る
  result = $vault.tool_read(name)
  MCP::Tool::Response.new([{ type: "text", text: result }])
end