Package org.saidone.restless.mcp
Class ContentServiceTools
java.lang.Object
org.saidone.restless.mcp.ContentServiceTools
MCP tools backed by ContentServiceClient.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreadContent(String nodeRef, Boolean binary, Long offset, Integer maxBytes) Reads a bounded slice of extracted UTF-8 text or stored binary content.updateContent(String nodeRef, String content, String contentBase64, String mimetype) Replaces the content of a document.
-
Constructor Details
-
ContentServiceTools
public ContentServiceTools()
-
-
Method Details
-
readContent
@Tool(name="alfresco_read_content", description="Reads the content of an Alfresco document. By default returns its plain text (\'text\'), extracted by Alfresco from PDF, Office, HTML and the other formats it can convert; with binary=true returns the stored bytes base64-encoded (\'contentBase64\'). Long content comes in slices of at most maxBytes bytes: while \'hasMore\' is true, call again with offset = \'nextOffset\'. \'size\' is the total size in bytes (of the extracted text in text mode). FAILED_PRECONDITION means the document format cannot be converted to text.") public String readContent(@ToolParam(description="Node to read: a nodeRef (workspace://SpacesStore/<id>), a bare node id, or one of the aliases -root- (Company Home), -my- (user home folder), -shared- (Shared Files)") String nodeRef, @ToolParam(description="Return the stored bytes base64-encoded instead of the extracted text (default false)",required=false) Boolean binary, @ToolParam(description="Byte offset to start from: 0 for the beginning, then the nextOffset of the previous slice",required=false) Long offset, @ToolParam(description="Slice size in bytes, 1..2097152 (default 100000)",required=false) Integer maxBytes) Reads a bounded slice of extracted UTF-8 text or stored binary content.- Parameters:
nodeRef- document nodebinary- true for stored bytes as base64, false or null for textoffset- byte offset in the selected representation, default zeromaxBytes- maximum bytes per slice, default 100,000- Returns:
- a JSON slice with a continuation offset when more bytes are available
-
updateContent
@Tool(name="alfresco_update_content", description="Replaces the content of an Alfresco document with text (\'content\') or base64 binary (\'contentBase64\'), then returns the document.") public String updateContent(@ToolParam(description="Node to read: a nodeRef (workspace://SpacesStore/<id>), a bare node id, or one of the aliases -root- (Company Home), -my- (user home folder), -shared- (Shared Files)") String nodeRef, @ToolParam(description="New text content (UTF-8)",required=false) String content, @ToolParam(description="New binary content encoded in base64",required=false) String contentBase64, @ToolParam(description="Mimetype; guessed from the document name when omitted",required=false) String mimetype) Replaces the content of a document.- Parameters:
nodeRef- document nodecontent- replacement UTF-8 textcontentBase64- replacement bytes, exclusive with textmimetype- explicit MIME type, or null to infer it from the document name- Returns:
- the updated node as JSON
-