Class: ClaudeSDK::McpServerConfig::StdioServer
- Inherits:
-
Object
- Object
- ClaudeSDK::McpServerConfig::StdioServer
- Defined in:
- lib/claude_sdk/types.rb
Overview
MCP stdio server configuration
Instance Attribute Summary collapse
-
#args ⇒ Object
command arguments.
-
#command ⇒ Object
the command to execute.
-
#env ⇒ Object
environment variables.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(command:, args: [], env: {}) ⇒ StdioServer
constructor
A new instance of StdioServer.
-
#to_h ⇒ Hash
Convert to hash for JSON serialization.
Constructor Details
#initialize(command:, args: [], env: {}) ⇒ StdioServer
Returns a new instance of StdioServer.
46 47 48 49 50 51 |
# File 'lib/claude_sdk/types.rb', line 46 def initialize(command:, args: [], env: {}) @type = :stdio @command = command @args = args @env = env end |
Instance Attribute Details
#args ⇒ Object
command arguments
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/claude_sdk/types.rb', line 39 class StdioServer attr_accessor :command, :args, :env attr_reader :type # @param command [String] the command to execute # @param args [Array<String>] command arguments # @param env [Hash<String, String>] environment variables def initialize(command:, args: [], env: {}) @type = :stdio @command = command @args = args @env = env end # Convert to hash for JSON serialization # # @return [Hash] def to_h hash = { command: command } hash[:type] = type.to_s unless type == :stdio # Optional for backwards compatibility hash[:args] = args unless args.empty? hash[:env] = env unless env.empty? hash end end |
#command ⇒ Object
the command to execute
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/claude_sdk/types.rb', line 39 class StdioServer attr_accessor :command, :args, :env attr_reader :type # @param command [String] the command to execute # @param args [Array<String>] command arguments # @param env [Hash<String, String>] environment variables def initialize(command:, args: [], env: {}) @type = :stdio @command = command @args = args @env = env end # Convert to hash for JSON serialization # # @return [Hash] def to_h hash = { command: command } hash[:type] = type.to_s unless type == :stdio # Optional for backwards compatibility hash[:args] = args unless args.empty? hash[:env] = env unless env.empty? hash end end |
#env ⇒ Object
environment variables
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/claude_sdk/types.rb', line 39 class StdioServer attr_accessor :command, :args, :env attr_reader :type # @param command [String] the command to execute # @param args [Array<String>] command arguments # @param env [Hash<String, String>] environment variables def initialize(command:, args: [], env: {}) @type = :stdio @command = command @args = args @env = env end # Convert to hash for JSON serialization # # @return [Hash] def to_h hash = { command: command } hash[:type] = type.to_s unless type == :stdio # Optional for backwards compatibility hash[:args] = args unless args.empty? hash[:env] = env unless env.empty? hash end end |
#type ⇒ Object
Returns the value of attribute type.
41 42 43 |
# File 'lib/claude_sdk/types.rb', line 41 def type @type end |
Instance Method Details
#to_h ⇒ Hash
Convert to hash for JSON serialization
56 57 58 59 60 61 62 |
# File 'lib/claude_sdk/types.rb', line 56 def to_h hash = { command: command } hash[:type] = type.to_s unless type == :stdio # Optional for backwards compatibility hash[:args] = args unless args.empty? hash[:env] = env unless env.empty? hash end |