Class: Seekmodo::Sdk::Mcp::Client
- Inherits:
-
Object
- Object
- Seekmodo::Sdk::Mcp::Client
- Defined in:
- lib/seekmodo/sdk/mcp/client.rb
Constant Summary collapse
- DEFAULT_GATEWAY_URL =
"https://mcp.seekmodo.com"
Instance Method Summary collapse
-
#initialize(gateway_url: DEFAULT_GATEWAY_URL, signer: nil, operator_token: nil, tenant_id: nil, connection: nil, user_agent: "seekmodo-ruby-sdk/0.5.0") ⇒ Client
constructor
A new instance of Client.
- #initialize_session(params = {}) ⇒ Object
- #ping ⇒ Object
- #tools_call(name, arguments = {}) ⇒ Object
- #tools_list ⇒ Object
Constructor Details
#initialize(gateway_url: DEFAULT_GATEWAY_URL, signer: nil, operator_token: nil, tenant_id: nil, connection: nil, user_agent: "seekmodo-ruby-sdk/0.5.0") ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/seekmodo/sdk/mcp/client.rb', line 15 def initialize( gateway_url: DEFAULT_GATEWAY_URL, signer: nil, operator_token: nil, tenant_id: nil, connection: nil, user_agent: "seekmodo-ruby-sdk/0.5.0" ) @gateway_url = gateway_url.to_s.delete_suffix("/") @signer = signer @operator_token = operator_token @tenant_id = tenant_id @user_agent = user_agent @connection = connection || Faraday.new do |f| f.adapter Faraday.default_adapter end @request_id = 0 if @signer.nil? && @operator_token.nil? raise ArgumentError, "MCP client requires signer (HMAC) or operator_token (bearer)" end end |
Instance Method Details
#initialize_session(params = {}) ⇒ Object
38 39 40 |
# File 'lib/seekmodo/sdk/mcp/client.rb', line 38 def initialize_session(params = {}) rpc("initialize", params) end |
#ping ⇒ Object
50 51 52 |
# File 'lib/seekmodo/sdk/mcp/client.rb', line 50 def ping rpc("ping", {}) end |
#tools_call(name, arguments = {}) ⇒ Object
46 47 48 |
# File 'lib/seekmodo/sdk/mcp/client.rb', line 46 def tools_call(name, arguments = {}) rpc("tools/call", { "name" => name, "arguments" => arguments }) end |
#tools_list ⇒ Object
42 43 44 |
# File 'lib/seekmodo/sdk/mcp/client.rb', line 42 def tools_list rpc("tools/list", {}) end |