25 lines
817 B
Ruby
25 lines
817 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Mcp do
|
|
it "can list tools" do
|
|
client = Mcp::Client.new("/Users/joshuacoles/.local/bin/mcp-server-fetch", [])
|
|
expect(client.list_tools).to_not be_nil
|
|
end
|
|
|
|
it 'can call tools' do
|
|
client = Mcp::Client.new("/Users/joshuacoles/.local/bin/mcp-server-fetch", [])
|
|
result = client.tools.fetch(url: 'http://example.com')
|
|
|
|
expect(result).to be_a(Hash)
|
|
expect(result['content'][0]).to be_a(Hash)
|
|
expect(result['content'][0]['text']).to include('Contents of http://example.com/')
|
|
end
|
|
|
|
it 'handles calls after disconnect' do
|
|
client = Mcp::Client.new("/Users/joshuacoles/.local/bin/mcp-server-fetch", [])
|
|
client.disconnect
|
|
|
|
expect { client.tools.fetch(url: 'http://example.com') }.to raise_error(Mcp::ClientDisconnectedError)
|
|
end
|
|
end
|