feat(posts): opt-in attachments on the posts list (API + agent tool) - #2012
Open
giladresisi wants to merge 1 commit into
Open
feat(posts): opt-in attachments on the posts list (API + agent tool)#2012giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
Adds an includeAttachments flag to GET /public/v1/posts and postsListTool that returns each post's attachments ({ id, path, thumbnail }) so agents can reuse media when mirroring posts. Default off to keep the list payload small; the calendar path is unchanged.
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature (backend public API + agent/MCP tool). Adds an opt-in
includeAttachmentsflag toGET /public/v1/posts(query param onGetPostsDto) and topostsListTool(boolean input). When set, each post gains anattachmentsarray of{ id, path, thumbnail }parsed from the post'simagecolumn inPostsService.getPosts;PostsRepository.getPostsonly selectsimagewhen the flag is on, following theincludeIntegrationpattern ofgetPost. The rawimagestring is never exposed. The tool description and the agent system prompt tell the agent to list with the flag and pass the returned paths straight back tointegrationSchedulePostToolwhen duplicating or mirroring posts. Default is off on both surfaces, so existing responses are byte-identical; the calendar path (getPostsMinified) is untouched. No frontend, migration or env changes.Why was this change needed?
A customer asked the Postiz agent to mirror all their upcoming Instagram and TikTok posts onto a new YouTube channel. The agent could read the post text but not the attached videos, because neither the List Posts API nor
postsListToolreturned attachments, so it could not copy the media and the request failed. There is no single-post read endpoint either, so the list is the only place an agent can learn what media a post carries.The flag is opt-in rather than always-on because of payload size: a post row is roughly 480 bytes today and each attachment adds about 140 bytes (about 230 bytes with a thumbnail), so a 10-image carousel quadruples its row and a 500-post window of such posts would grow by roughly 0.7 to 1.1 MB. Most list calls (calendar-style browsing, status checks) do not need media, so the default keeps them unchanged and the agent is instructed to ask for attachments only when it needs to reuse media.
Other information:
Related PRs, both to be merged only after this one is deployed:
postsListToolin the MCP tools page)posts:list --includeAttachments, skill rule to reuse listed paths)QA
GET /public/v1/posts?startDate=...&endDate=...for a window containing a post with media, with no extra param: the response is unchanged, noattachmentsand noimagekey on any post&includeAttachments=false: same as step 1&includeAttachments=true: every post has anattachmentsarray; posts with media list{ id, path, thumbnail }entries (thumbnailnullwhen absent), posts without media have[]; still noimagekey&includeAttachments=yes: HTTP 400tools/listand checkpostsListToolshows theincludeAttachmentsinput and theattachmentsoutput fieldpostsListToolwithout the flag: items have noattachments; withincludeAttachments: true: items carry the same attachments as step 3integrationSchedulePostTool) passing one of the returnedpathvalues as the attachment, then list that window with the flag: the new draft shows the identical attachment path/postsresponse still has no image/attachment data, with or withoutincludeAttachments=trueappendedChecklist: