struct
ACP::Protocol::ResourceContentBlock
- ACP::Protocol::ResourceContentBlock
- ACP::Protocol::ContentBlock
- Struct
- Value
- Object
Overview
Complete resource contents embedded directly in the message.
This is the preferred way to include context in prompts, such as
when using @-mentions to reference files or other resources.
Requires the embeddedContext prompt capability.
See: https://agentclientprotocol.com/protocol/content#embedded-resource
Included Modules
- JSON::Serializable
Defined in:
acp/protocol/content_block.crConstructors
-
.blob(uri : String, blob : String, mime_type : String | Nil = nil) : ResourceContentBlock
Creates a ResourceContentBlock with blob resource contents.
-
.from_path(path : String, mime_type : String | Nil = nil) : ResourceContentBlock
@deprecated Use ResourceContentBlock.text or .blob factory methods instead.
-
.new(pull : JSON::PullParser)
Complete resource contents embedded directly in the message.
- .new(resource : JSON::Any, annotations : Annotations | Nil = nil, meta : Hash(String, JSON::Any) | Nil = nil)
-
.text(uri : String, text : String, mime_type : String | Nil = nil) : ResourceContentBlock
Creates a ResourceContentBlock with text resource contents.
Instance Method Summary
-
#annotations : Annotations | Nil
Optional metadata about how the content should be used or displayed.
-
#annotations=(annotations : Annotations | Nil)
Optional metadata about how the content should be used or displayed.
-
#blob : String | Nil
Helper: get the blob from the embedded resource (nil if text).
-
#meta : Hash(String, JSON::Any) | Nil
Extension metadata.
-
#meta=(meta : Hash(String, JSON::Any) | Nil)
Extension metadata.
-
#resource : JSON::Any
The embedded resource contents.
-
#resource=(resource : JSON::Any)
The embedded resource contents.
-
#resource_mime_type : String | Nil
Helper: get the MIME type from the embedded resource.
-
#text : String | Nil
Helper: get the text from the embedded resource (nil if blob).
-
#type : String
Always "resource" for this block type.
-
#uri : String | Nil
Helper: get the URI from the embedded resource.
Instance methods inherited from struct ACP::Protocol::ContentBlock
type : String
type
Constructor methods inherited from struct ACP::Protocol::ContentBlock
new(pull : JSON::PullParser)
new
Constructor Detail
Creates a ResourceContentBlock with blob resource contents.
@deprecated Use ResourceContentBlock.text or .blob factory methods instead. Backward-compatible constructor from a file path.
Complete resource contents embedded directly in the message.
This is the preferred way to include context in prompts, such as
when using @-mentions to reference files or other resources.
Requires the embeddedContext prompt capability.
See: https://agentclientprotocol.com/protocol/content#embedded-resource
Creates a ResourceContentBlock with text resource contents.
Instance Method Detail
Optional metadata about how the content should be used or displayed.
Optional metadata about how the content should be used or displayed.
The embedded resource contents. Can be either a TextResourceContents or BlobResourceContents. Stored as JSON::Any for flexible parsing.
The embedded resource contents. Can be either a TextResourceContents or BlobResourceContents. Stored as JSON::Any for flexible parsing.