137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/cuboid/mcp/core_tools.rb', line 137
def self.call( options: {}, start: true, live: true, server_context: nil, ** )
CoreTools.instrumented_call do
instance = ::Cuboid::Server::InstanceHelpers.spawn
live_attached = false
if live
options = CoreTools.inject_live_plugin(
options,
instance_id: instance.token,
server_context: server_context
)
live_attached = options != nil && options['plugins'] && options['plugins']['live']
end
if start
begin
instance.run( options )
rescue => e
(instance.shutdown rescue nil)
::Cuboid::MCP::Live.unregister( instance.token ) if live_attached
raise e
end
end
CoreTools.instances[instance.token] = instance
result = { instance_id: instance.token, url: instance.url }
if live_attached
result[:live] = {
notification_method: ::Cuboid::MCP::Live.notification_method
}
end
result
end
end
|