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.
1509 1510 1511 1512 1513 1514 1515 1516 1517 |
# File 'lib/claude_agent_sdk/types.rb', line 1509 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.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def config @config end |
#error ⇒ Object
Returns the value of attribute error.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def error @error end |
#name ⇒ Object
Returns the value of attribute name.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def scope @scope end |
#server_info ⇒ Object
Returns the value of attribute server_info.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def server_info @server_info end |
#status ⇒ Object
Returns the value of attribute status.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def status @status end |
#tools ⇒ Object
Returns the value of attribute tools.
1507 1508 1509 |
# File 'lib/claude_agent_sdk/types.rb', line 1507 def tools @tools end |
Class Method Details
.parse(data) ⇒ Object
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 |
# File 'lib/claude_agent_sdk/types.rb', line 1519 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
1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 |
# File 'lib/claude_agent_sdk/types.rb', line 1535 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 |