Skip to content

feat(agent): list posts via a tool aligned with the List Posts API - #1816

Open
giladresisi wants to merge 2 commits into
mainfrom
feat/agent-list-posts
Open

feat(agent): list posts via a tool aligned with the List Posts API#1816
giladresisi wants to merge 2 commits into
mainfrom
feat/agent-list-posts

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

Why

A user scheduled many TikTok posts with the wrong settings and wants an agent to batch-update them — which first requires the agent to find those posts. This adds a list tool for that, aligned with the existing public List Posts endpoint so the two don't drift.

Replaces #1751. That PR accidentally ended up containing the separate update-post-settings work, because its stacked companion (#1752) was merged into its branch instead of into main. This is the clean, list-only version; nothing from either reached main.

What changed

  • postsListTool (agent / MCP): lists the organization's posts between two dates. It calls the same PostsService.getPosts as the public GET /public/v1/posts endpoint (same inputs: startDate, endDate, optional customer), so the tool and the API stay aligned.
  • getPosts now selects settings, so both the tool and the public List Posts endpoint return each post's current provider settings. Additive and backward-compatible.
  • Fixes a pre-existing bug in getPosts where passing customer overwrote the integration deletedAt/organizationId checks (a duplicate integration key in the where clause), surfacing posts on soft-deleted integrations. Merged into the single integration filter, as getPostsList already does. Flagged by Sentry on feat(agent): list posts via a tool aligned with the List Posts API #1751.

Public API impact

GET /public/v1/posts now returns a settings field on each post. Additive — existing consumers are unaffected.

Testing

Tested end to end: the public API via the CLI + skill, and the agent tools via the internal web-app agent and Claude Code over the remote MCP.

Related

Docs PR: gitroomhq/postiz-docs#232 (documents the new settings field and adds postsListTool to the MCP docs). No postiz-agent change for this PR.

giladresisi and others added 2 commits July 20, 2026 18:05
Adds postsListTool (agent / MCP) so an agent can find the org's posts.
It calls the same PostsService.getPosts as the public "List Posts"
endpoint (GET /public/v1/posts), with the same inputs (startDate,
endDate, optional customer) and the same source data, so the tool and
the API stay aligned instead of drifting into a separate query. Each
item carries the post id (to pass to updatePostSettingsTool), publish
date, state, content, channel and current provider settings.

Also selects `settings` in getPosts, so both the tool and the public
List Posts endpoint now return each post's provider settings (needed to
know which posts require a settings change). This adds a `settings`
field to the GET /public/v1/posts response.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tomer

getPosts declared the integration relation filter twice in the same where
object: once with { deletedAt: null, organizationId } and again, only when
a customer is passed, with { customerId }. The second key overwrote the
first, so filtering by customer dropped the soft-delete and org checks and
surfaced posts on soft-deleted integrations. Merge customerId into the
single integration filter instead (as getPostsList already does).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@postiz-agent

postiz-agent Bot commented Jul 31, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant