Class: ClaudeAgentSDK::McpServerStatus
- Inherits:
-
Object
- Object
- ClaudeAgentSDK::McpServerStatus
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Status of a single MCP server connection
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#error ⇒ Object
Returns the value of attribute error.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#server_info ⇒ Object
Returns the value of attribute server_info.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tools ⇒ Object
Returns the value of attribute tools.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, status:, server_info: nil, error: nil, config: nil, scope: nil, tools: nil) ⇒ McpServerStatus
constructor
A new instance of McpServerStatus.
Constructor Details
#initialize(name:, status:, server_info: nil, error: nil, config: nil, scope: nil, tools: nil) ⇒ McpServerStatus
Returns a new instance of McpServerStatus.
1479 1480 1481 1482 1483 1484 1485 1486 1487 |
# File 'lib/claude_agent_sdk/types.rb', line 1479 def initialize(name:, status:, server_info: nil, error: nil, config: nil, scope: nil, tools: nil) @name = name @status = status @server_info = server_info @error = error @config = config @scope = scope @tools = tools end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def config @config end |
#error ⇒ Object
Returns the value of attribute error.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def error @error end |
#name ⇒ Object
Returns the value of attribute name.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def scope @scope end |
#server_info ⇒ Object
Returns the value of attribute server_info.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def server_info @server_info end |
#status ⇒ Object
Returns the value of attribute status.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def status @status end |
#tools ⇒ Object
Returns the value of attribute tools.
1477 1478 1479 |
# File 'lib/claude_agent_sdk/types.rb', line 1477 def tools @tools end |
Class Method Details
.parse(data) ⇒ Object
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 |
# File 'lib/claude_agent_sdk/types.rb', line 1489 def self.parse(data) server_info = (McpServerInfo.new(name: data[:serverInfo][:name], version: data[:serverInfo][:version]) if data[:serverInfo]) tools = data[:tools]&.map { |t| McpToolInfo.parse(t) } config = parse_config(data[:config]) new( name: data[:name], status: data[:status], server_info: server_info, error: data[:error], config: config, scope: data[:scope], tools: tools ) end |
.parse_config(config) ⇒ Object
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 |
# File 'lib/claude_agent_sdk/types.rb', line 1505 def self.parse_config(config) return config unless config.is_a?(Hash) && config[:type] case config[:type] when 'claudeai-proxy' McpClaudeAIProxyServerConfig.new(url: config[:url], id: config[:id]) when 'sdk' McpSdkServerConfigStatus.new(name: config[:name]) else config end end |