Class: LittleGhost::MCP::Result
- Inherits:
-
Data
- Object
- Data
- LittleGhost::MCP::Result
- Defined in:
- lib/little_ghost/mcp/types.rb,
lib/little_ghost/mcp/types.rb
Overview
Represents one MCP Tool result without discarding server fields. Mapping callbacks can inspect normalized content, structured content, metadata, or the complete protocol value.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#structured_content ⇒ Object
readonly
Returns the value of attribute structured_content.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(content:, raw:, structured_content: nil, error: false, metadata: {}) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(content:, raw:, structured_content: nil, error: false, metadata: {}) ⇒ Result
Returns a new instance of Result.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/little_ghost/mcp/types.rb', line 167 def initialize(content:, raw:, structured_content: nil, error: false, metadata: {}) unless error.nil? || error == true || error == false raise ProtocolError, "MCP tool result isError must be boolean" end super( content: ImmutableValue.array(content, field: "tool result content"), structured_content: ImmutableValue.optional_mapping( structured_content, field: "structuredContent" ), error: !!error, metadata: ImmutableValue.mapping(, field: "tool result _meta"), raw: ImmutableValue.mapping(raw, field: "tool result") ) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content
166 167 168 |
# File 'lib/little_ghost/mcp/types.rb', line 166 def content @content end |
#error ⇒ Object (readonly)
Returns the value of attribute error
166 167 168 |
# File 'lib/little_ghost/mcp/types.rb', line 166 def error @error end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
166 167 168 |
# File 'lib/little_ghost/mcp/types.rb', line 166 def @metadata end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw
166 167 168 |
# File 'lib/little_ghost/mcp/types.rb', line 166 def raw @raw end |
#structured_content ⇒ Object (readonly)
Returns the value of attribute structured_content
166 167 168 |
# File 'lib/little_ghost/mcp/types.rb', line 166 def structured_content @structured_content end |
Instance Method Details
#error? ⇒ Boolean
184 |
# File 'lib/little_ghost/mcp/types.rb', line 184 def error? = error |