Some checks failed
Ruby / Ruby ${{ matrix.ruby }} (3.4.1) (push) Failing after 9m36s
33 lines
562 B
Ruby
33 lines
562 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "mcp/version"
|
|
|
|
module Mcp
|
|
class Error < StandardError; end
|
|
|
|
class Client
|
|
def tools
|
|
ToolsProxy.new(self)
|
|
end
|
|
end
|
|
|
|
class ToolsProxy
|
|
def initialize(client)
|
|
@client = client
|
|
@tools = client.list_tools
|
|
end
|
|
|
|
private
|
|
|
|
def respond_to_missing?(name, include_private = false)
|
|
@tools.any? { |tool| tool["name"] == name.to_s } || super
|
|
end
|
|
|
|
def method_missing(name, **kwargs)
|
|
@client.call_tool(name, **kwargs)
|
|
end
|
|
end
|
|
end
|
|
|
|
require_relative "mcp/mcp"
|