struct ACP::Protocol::ResourceContentBlock

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

Defined in:

acp/protocol/content_block.cr

Constructors

Instance Method Summary

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

def self.blob(uri : String, blob : String, mime_type : String | Nil = nil) : ResourceContentBlock #

Creates a ResourceContentBlock with blob resource contents.


[View source]
def self.from_path(path : String, mime_type : String | Nil = nil) : ResourceContentBlock #

@deprecated Use ResourceContentBlock.text or .blob factory methods instead. Backward-compatible constructor from a file path.


[View source]
def self.new(pull : JSON::PullParser) #

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


[View source]
def self.new(resource : JSON::Any, annotations : Annotations | Nil = nil, meta : Hash(String, JSON::Any) | Nil = nil) #

[View source]
def self.text(uri : String, text : String, mime_type : String | Nil = nil) : ResourceContentBlock #

Creates a ResourceContentBlock with text resource contents.


[View source]

Instance Method Detail

def annotations : Annotations | Nil #

Optional metadata about how the content should be used or displayed.


[View source]
def annotations=(annotations : Annotations | Nil) #

Optional metadata about how the content should be used or displayed.


[View source]
def blob : String | Nil #

Helper: get the blob from the embedded resource (nil if text).


[View source]
def meta : Hash(String, JSON::Any) | Nil #

Extension metadata.


[View source]
def meta=(meta : Hash(String, JSON::Any) | Nil) #

Extension metadata.


[View source]
def resource : JSON::Any #

The embedded resource contents. Can be either a TextResourceContents or BlobResourceContents. Stored as JSON::Any for flexible parsing.


[View source]
def resource=(resource : JSON::Any) #

The embedded resource contents. Can be either a TextResourceContents or BlobResourceContents. Stored as JSON::Any for flexible parsing.


[View source]
def resource_mime_type : String | Nil #

Helper: get the MIME type from the embedded resource.


[View source]
def text : String | Nil #

Helper: get the text from the embedded resource (nil if blob).


[View source]
def type : String #

Always "resource" for this block type.


[View source]
def uri : String | Nil #

Helper: get the URI from the embedded resource.


[View source]