Class: Foobara::McpConnector::Commands::Initialize
- Defined in:
- foobara-mcp-connector-0.0.4/src/commands/initialize.rb
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary collapse
-
#session ⇒ Object
Returns the value of attribute session.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes included from CommandPatternImplementation::Concerns::Subcommands
Attributes included from CommandPatternImplementation::Concerns::Runtime
Attributes included from CommandPatternImplementation::Concerns::Errors
Attributes included from CommandPatternImplementation::Concerns::Inputs
Instance Method Summary collapse
-
#build_result ⇒ Object
Just hard-coding a bunch of these values to a limited set of abilities for now.
- #command_connector ⇒ Object
- #create_session ⇒ Object
- #determine_version ⇒ Object
- #execute ⇒ Object
- #notify_connector_of_session ⇒ Object
Methods inherited from Command
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from CommandPatternImplementation::Concerns::Reflection
Methods included from CommandPatternImplementation::Concerns::DomainMappers
#domain_map, #domain_map!, #run_mapped_subcommand!
Methods included from CommandPatternImplementation::Concerns::Subcommands
#run_subcommand!, #subcommand?
Methods included from CommandPatternImplementation::Concerns::Entities
Methods included from CommandPatternImplementation::Concerns::Transactions
#auto_detect_current_transactions, #commit_transaction, #open_transaction, #opened_transactions, #relevant_entity_classes, #rollback_transaction, #transactions
Methods included from CommandPatternImplementation::Concerns::StateMachine
Methods included from CommandPatternImplementation::Concerns::Runtime
#halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records
Methods included from CommandPatternImplementation::Concerns::Errors
Methods included from CommandPatternImplementation::Concerns::Inputs
#cast_and_validate_inputs, #initialize, #method_missing, #respond_to_missing?, #respond_to_missing_for_inputs?
Methods included from TruncatedInspect
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs
Instance Attribute Details
#session ⇒ Object
Returns the value of attribute session.
57 58 59 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 57 def session @session end |
#version ⇒ Object
Returns the value of attribute version.
57 58 59 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 57 def version @version end |
Instance Method Details
#build_result ⇒ Object
Just hard-coding a bunch of these values to a limited set of abilities for now
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 84 def build_result { protocolVersion: version, capabilities: { # We only support tools for now and don't yet support updating lists of tools tools: { listChanged: false } }, serverInfo: { name: command_connector.server_name, version: command_connector.server_version }, instructions: command_connector.instructions } end |
#command_connector ⇒ Object
67 68 69 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 67 def command_connector request.command_connector end |
#create_session ⇒ Object
59 60 61 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 59 def create_session self.session = Session.new(inputs.except(:request)) end |
#determine_version ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 71 def determine_version versions_to_choose_from = SUPPORTED_VERSIONS.select do |supported_version| supported_version <= protocolVersion end if versions_to_choose_from.empty? versions_to_choose_from = SUPPORTED_VERSIONS end self.version = versions_to_choose_from.max end |
#execute ⇒ Object
49 50 51 52 53 54 55 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 49 def execute create_session notify_connector_of_session determine_version build_result end |
#notify_connector_of_session ⇒ Object
63 64 65 |
# File 'foobara-mcp-connector-0.0.4/src/commands/initialize.rb', line 63 def notify_connector_of_session command_connector.session_created(session) end |