Class: Insika::Commands::ImportMcpTools
- Inherits:
-
Object
- Object
- Insika::Commands::ImportMcpTools
- Defined in:
- lib/insika/commands/import_mcp_tools.rb
Overview
Control command: LIVE MCP ingestion. Receives the NAME of
an MCP instance, delegates to McpToolIngestor (discovers via an injectable client
-> builds the manifest -> reuses :import_tools: batch upsert + hot reload)
and returns the per-tool report in the shape of :import_tools, plus
instance:. Idempotent (re-ingesting reconciles). A per-tool failure is isolated
in errors[] (R4); an absent/disabled/url-less instance raises.
-> { instance, version, created: [names], updated: [names], errors: [tool,error] }
Instance Method Summary collapse
- #call(command) ⇒ Object
-
#initialize(ingestor:, event_stream:) ⇒ ImportMcpTools
constructor
A new instance of ImportMcpTools.
Constructor Details
#initialize(ingestor:, event_stream:) ⇒ ImportMcpTools
Returns a new instance of ImportMcpTools.
15 16 17 18 |
# File 'lib/insika/commands/import_mcp_tools.rb', line 15 def initialize(ingestor:, event_stream:) @ingestor = ingestor @event_stream = event_stream end |
Instance Method Details
#call(command) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/insika/commands/import_mcp_tools.rb', line 20 def call(command) p = symbolize(command.payload) name = Insika::Coercion.presence(p[:name]) || (raise Insika::ValidationError, "import_mcp_tools: 'name' (MCP instance) is required") report = @ingestor.ingest(name) emit(report) report end |