42 lines
714 B
Ruby
42 lines
714 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "mcp/version"
|
|
|
|
module Mcp
|
|
class Error < StandardError; end
|
|
|
|
class ClientDisconnectedError < Error; end
|
|
|
|
class Client
|
|
def initialize(command, args)
|
|
# This is implemented in rust
|
|
raise NotImplementedError
|
|
end
|
|
|
|
def list_tools
|
|
raise NotImplementedError
|
|
end
|
|
|
|
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) end
|
|
|
|
def method_missing(name, **kwargs)
|
|
@client.call_tool(name.to_s, kwargs)
|
|
end
|
|
end
|
|
end
|
|
|
|
require_relative "mcp/mcp"
|