30 #ifndef PT_MCP_CONTENTTYPE_H
31 #define PT_MCP_CONTENTTYPE_H
33 #include <Pt/Mcp/Api.h>
34 #include <Pt/Formatter.h>
91 void write(
const char* s, std::size_t n);
171 explicit ImageContent(
const std::string& mimeType =
"image/png");
178 std::string _mimeType;
187 #endif // PT_MCP_CONTENTTYPE_H
Core module.
Definition: Allocator.h:33
virtual void onBeginContent()=0
Writes the opening bytes of the concrete content block.
ContentFormatter * getFormatter() const override
Creates a new ContentFormatter for a result.
virtual Pt::Formatter & onBeginFormat()=0
Returns the Formatter the decomposed result is drained into.
virtual ContentFormatter * getFormatter() const =0
Creates a new ContentFormatter for a result.
std::ostream & output() const
Returns the output stream passed to beginContent().
Definition: ContentType.h:95
Formats tool results as MCP image content.
Definition: ContentType.h:169
Writes the wrapper bytes of an MCP content block around a Formatter.
Definition: ContentType.h:55
ContentFormatter * getFormatter() const override
Creates a new ContentFormatter for a result.
void releaseFormatter(ContentFormatter *formatter) const override
Releases a ContentFormatter previously obtained from getFormatter().
void releaseFormatter(ContentFormatter *formatter) const override
Releases a ContentFormatter previously obtained from getFormatter().
virtual void releaseFormatter(ContentFormatter *formatter) const =0
Releases a ContentFormatter previously obtained from getFormatter().
Formats a tool result as MCP content.
Definition: ContentType.h:120
virtual void onFinishContent()=0
Writes the closing bytes of the concrete content block.
void finishContent(std::ostream &os)
Flushes buffered output and writes the closing bytes of the content array to os.
Formats tool results as MCP text content.
Definition: ContentType.h:149
void write(const char *s, std::size_t n)
Writes raw bytes to the output stream.
Pt::Formatter & beginContent(std::ostream &os)
Writes the opening bytes of the content block to os and returns the Formatter the result is to be dec...