rename lib/{model_context_protocol => mcp}
This commit is contained in:
parent
a09f4786b4
commit
9d2447b351
10 changed files with 62 additions and 63 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class ConfigurationTest < ActiveSupport::TestCase
|
||||
test "initializes with a default no-op exception reporter" do
|
||||
config = Configuration.new
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class InstrumentationTest < ActiveSupport::TestCase
|
||||
class Subject
|
||||
include Instrumentation
|
||||
attr_reader :instrumentation_data_received, :configuration
|
||||
|
||||
def initialize
|
||||
@configuration = ModelContextProtocol::Configuration.new
|
||||
@configuration = MCP::Configuration.new
|
||||
@configuration.instrumentation_callback = ->(data) { @instrumentation_data_received = data }
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class MethodsTest < ActiveSupport::TestCase
|
||||
test "ensure_capability! for tools/list method raises an error if tools capability is not present" do
|
||||
error = assert_raises(Methods::MissingRequiredCapabilityError) do
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class PromptTest < ActiveSupport::TestCase
|
||||
class TestPrompt < Prompt
|
||||
description "Test prompt"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require "test_helper"
|
|||
require "json"
|
||||
require "debug"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class ServerTest < ActiveSupport::TestCase
|
||||
include InstrumentationTestHelper
|
||||
setup do
|
||||
|
|
@ -47,7 +47,7 @@ module ModelContextProtocol
|
|||
)
|
||||
|
||||
@server_name = "test_server"
|
||||
configuration = ModelContextProtocol::Configuration.new
|
||||
configuration = MCP::Configuration.new
|
||||
configuration.instrumentation_callback = instrumentation_helper.callback
|
||||
|
||||
@server = Server.new(
|
||||
|
|
@ -61,7 +61,7 @@ module ModelContextProtocol
|
|||
)
|
||||
end
|
||||
|
||||
# https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/utilities/ping/#behavior-requirements
|
||||
# https://spec.MCP.io/specification/2025-03-26/basic/utilities/ping/#behavior-requirements
|
||||
test "#handle ping request returns empty response" do
|
||||
request = {
|
||||
jsonrpc: "2.0",
|
||||
|
|
@ -655,14 +655,14 @@ module ModelContextProtocol
|
|||
|
||||
test "the global configuration is used if no configuration is passed to the server" do
|
||||
server = Server.new(name: "test_server")
|
||||
assert_equal ModelContextProtocol.configuration.instrumentation_callback,
|
||||
assert_equal MCP.configuration.instrumentation_callback,
|
||||
server.configuration.instrumentation_callback
|
||||
assert_equal ModelContextProtocol.configuration.exception_reporter,
|
||||
assert_equal MCP.configuration.exception_reporter,
|
||||
server.configuration.exception_reporter
|
||||
end
|
||||
|
||||
test "the server configuration takes precedence over the global configuration" do
|
||||
configuration = ModelContextProtocol::Configuration.new
|
||||
configuration = MCP::Configuration.new
|
||||
local_callback = ->(data) { puts "Local callback #{data.inspect}" }
|
||||
local_exception_reporter = ->(exception, server_context) {
|
||||
puts "Local exception reporter #{exception.inspect} #{server_context.inspect}"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class StringUtilsTest < Minitest::Test
|
||||
def test_handle_from_class_name_returns_the_class_name_without_the_module_for_a_class_without_a_module
|
||||
assert_equal("test", StringUtils.handle_from_class_name("Test"))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class Tool
|
||||
class InputSchemaTest < ActiveSupport::TestCase
|
||||
test "required arguments are converted to symbols" do
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
require "test_helper"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
class ToolTest < ActiveSupport::TestCase
|
||||
class TestTool < Tool
|
||||
tool_name "test_tool"
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
require "model_context_protocol/transports/stdio"
|
||||
require "mcp/transports/stdio"
|
||||
require "json"
|
||||
|
||||
module ModelContextProtocol
|
||||
module MCP
|
||||
module Transports
|
||||
class StdioTransportTest < ActiveSupport::TestCase
|
||||
include InstrumentationTestHelper
|
||||
|
||||
setup do
|
||||
configuration = ModelContextProtocol::Configuration.new
|
||||
configuration = MCP::Configuration.new
|
||||
configuration.instrumentation_callback = instrumentation_helper.callback
|
||||
@server = Server.new(name: "test_server", configuration: configuration)
|
||||
@transport = StdioTransport.new(@server)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ENV["RAILS_ENV"] ||= "test"
|
||||
|
||||
require "bundler/setup"
|
||||
require "model_context_protocol"
|
||||
require "mcp"
|
||||
|
||||
require "minitest/autorun"
|
||||
require "minitest/reporters"
|
||||
|
|
|
|||
Loading…
Reference in a new issue