postiz_delete_post_group
Delete an entire cross-post group in one API call. Use to retract all posts within a cross-post unit. Requires confirmation parameter set to true.
Instructions
Delete every post in a group (cross-post unit) via DELETE /api/posts/group/{group}. Use when you want to retract a whole cross-post in one call. Requires enableWrite + enableDelete + confirm=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group | Yes | ||
| confirm | Yes | Must be true. Removes every post in the group. |
Implementation Reference
- src/tools/delete-post-group.ts:18-59 (handler)The main handler factory 'createDeletePostGroupTool' that defines the tool name, parameters, and execute function. The execute function validates the delete gate, confirms the action, calls client.deletePostGroup(), and returns results with error handling for 404.
export function createDeletePostGroupTool( getClient: () => PostizClient, config: PostizPluginConfig, ) { return { name: "postiz_delete_post_group", label: "postiz: delete post group", description: "Delete every post in a group (cross-post unit) via DELETE /api/posts/group/{group}. Use when you want to retract a whole cross-post in one call. Requires enableWrite + enableDelete + confirm=true.", parameters: Schema, execute: async (_id: string, raw: Record<string, unknown>) => { requireDeleteGate(config, "postiz_delete_post_group"); const { group, confirm } = raw as { group: string; confirm: boolean }; requireConfirm("postiz_delete_post_group", confirm); const client = getClient(); try { const res = await client.deletePostGroup(group); return jsonToolResult( withRate(client, { ok: true, action: "delete_post_group", group, response: res, }), ); } catch (err) { if (err instanceof PostizApiError && err.status === 404) { return jsonToolResult( withRate(client, { ok: false, action: "delete_post_group", group, reason: "not_found", message: "Group not found. May have already been deleted.", }), ); } throw err; } }, }; } - src/tools/delete-post-group.ts:7-16 (schema)The input schema defining 'group' (string) and 'confirm' (boolean) parameters for the tool.
const Schema = Type.Object( { group: Type.String({ description: "Group id (cross-post unit) to delete." }), confirm: Type.Boolean({ description: "Must be true. Deletes EVERY post in the group across every integration. Already-published platform posts remain live; only Postiz records are removed.", }), }, { additionalProperties: false }, ); - mcp-server.ts:232-235 (registration)Registration of the tool in the MCP server via bind() call, mapping group and confirm parameters.
bind(server, createDeletePostGroupTool(getClient, config), { group: z.string(), confirm: z.boolean().describe("Must be true. Removes every post in the group."), }); - index.ts:80-82 (registration)Registration of the tool in the agent API via api.registerTool().
api.registerTool( createDeletePostGroupTool(getClient, config) as AnyAgentTool, ); - src/postiz-client.ts:289-298 (helper)The HTTP client method 'deletePostGroup' that calls DELETE /api/public/v1/posts/group/{group}.
/** DELETE /api/public/v1/posts/group/{group} (newer Postiz builds) */ async deletePostGroup(group: string): Promise<Record<string, unknown>> { if (!isSafeId(group)) { throw new Error(`Invalid group id: ${group}`); } return this.request<Record<string, unknown>>( `/api/public/v1/posts/group/${group}`, { method: "DELETE" }, ); }