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:
parent
f5a3567494
commit
0645351585
1 changed files with 359 additions and 39 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue