Internal Release 0.3.0

Add configurable exception reporter
Avoid leaking tool exceptions by sending them to a configurable exception reporter
Add optional context to pass to tools
Add basic instrumentation data/labels
This commit is contained in:
Topher Bullock 2025-03-24 08:02:32 -04:00
commit 0645351585

View file

@ -44,8 +44,8 @@ module ModelContextProtocol
def define(name: nil, description: nil, input_schema: nil, &block)
new(name:, description:, input_schema:).tap do |tool|
tool.define_singleton_method(:call) do |*args|
instance_exec(*args, &block)
tool.define_singleton_method(:call) do |*args, context:|
instance_exec(*args, context:, &block)
end
end
end
@ -59,7 +59,7 @@ module ModelContextProtocol
@input_schema = input_schema || self.class.input_schema_value
end
def call(*args)
def call(*args, context:)
raise NotImplementedError, "Subclasses must implement call"
end