|
cxxmcp 1.1.6
C++ MCP SDK
|
A single content item returned by a tool or embedded in prompts. More...
#include <tool.hpp>
Public Member Functions | |
| bool | is_text () const noexcept |
| Returns true when this block is a text block. | |
| bool | is_image () const noexcept |
| Returns true when this block is an image block. | |
| bool | is_audio () const noexcept |
| Returns true when this block is an audio block. | |
| bool | is_embedded_resource () const noexcept |
| Returns true when this block embeds resource contents. | |
| bool | is_resource_link () const noexcept |
| Returns true when this block links to a resource descriptor. | |
| std::optional< std::string_view > | as_text () const noexcept |
| Returns the text payload when this is a text block. | |
| std::optional< std::string_view > | as_image_data () const |
| Returns base64 image data when this is an image block. | |
| std::optional< std::string_view > | as_audio_data () const |
| Returns base64 audio data when this is an audio block. | |
| const ResourceContents * | as_embedded_resource () const noexcept |
| Returns embedded resource contents when present. | |
| const Resource * | as_resource_link () const noexcept |
| Returns the linked resource descriptor when present. | |
Static Public Member Functions | |
| static ContentBlock | text_content (std::string value) |
| Creates a text content block. | |
| static ContentBlock | image (std::string base64_data, std::string mime_type) |
| Creates an image content block with base64 data. | |
| static ContentBlock | audio (std::string base64_data, std::string mime_type) |
| Creates an audio content block with base64 data. | |
| static ContentBlock | embedded_resource (ResourceContents value) |
| Creates an embedded resource content block. | |
| static ContentBlock | resource_link_content (Resource value) |
| Creates a resource link content block. | |
Public Attributes | |
| std::string | type = "text" |
| Content kind. | |
| std::string | text |
| Text payload for text blocks. | |
| Json | data = Json::object() |
| Base64 payload for image/audio blocks or extension data for custom blocks. | |
| std::string | mime_type |
| MIME type for image/audio blocks. | |
| std::optional< ResourceContents > | resource |
Embedded resource contents for resource blocks. | |
| std::optional< Resource > | resource_link |
Resource descriptor for resource_link blocks. | |
| Json | annotations = Json::object() |
| Optional annotations for model or client presentation. | |
| std::optional< Json > | meta |
Optional _meta extension object preserved on the wire. | |
| Json | extensions = Json::object() |
| Unknown JSON members preserved for forward-compatible round trips. | |
A single content item returned by a tool or embedded in prompts.
| std::string mcp::protocol::ContentBlock::type = "text" |
Content kind.
Common values are text, image, audio, resource, and resource_link.