paperclip-app / packages /shared-postiz /src /tool-definitions.ts
github-actions[bot]
deploy 2026-04-24T08:06
8523e75
Raw
History Blame Contribute Delete
7.68 kB
/**
* OpenAI function calling format tool definitions for Postiz MCP tools.
*
* These definitions can be used by GLM and other OpenAI-compatible adapters
* to expose Postiz capabilities to their agents.
*/
export const POSTIZ_TOOLS = [
{
type: "function" as const,
function: {
name: "postiz_list_channels",
description:
"List connected social media channels (Facebook, X, LinkedIn, etc.). Returns channel IDs, names, and platforms. Call this first to discover available channels.",
parameters: {
type: "object",
properties: {},
required: [],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_get_platform_schema",
description:
"Get platform-specific rules, max character limits, settings schema, and available sub-tools. MUST call before scheduling posts to understand platform constraints.",
parameters: {
type: "object",
properties: {
platform: {
type: "string",
description: "Platform name (twitter, linkedin, facebook, instagram, youtube, tiktok, pinterest, reddit, discord, slack, mastodon, bluesky, threads, dribbble)",
},
isPremium: {
type: "boolean",
description: "Whether the integration is premium (affects character limits on some platforms like X). Set to false for standard accounts.",
},
},
required: ["platform", "isPremium"],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_trigger_tool",
description:
"Call platform-specific sub-tools. Examples: get Pinterest boards, YouTube tags, TikTok voice IDs. Use integrationSchema to discover available sub-tools first.",
parameters: {
type: "object",
properties: {
integrationId: {
type: "string",
description: "Integration/channel ID from postiz_list_channels",
},
methodName: {
type: "string",
description: "Sub-tool method name (e.g., 'getBoards', 'getTags', 'getVoiceIds')",
},
dataSchema: {
type: "object",
description: "Parameters for the sub-tool method",
},
},
required: ["integrationId", "methodName"],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_schedule_post",
description:
"Schedule or publish social media posts. Content must be HTML format using <p>, <strong>, <br>, <ul>, <li> tags. Set type to 'now' for immediate publishing, 'schedule' with date, or 'draft'.",
parameters: {
type: "object",
properties: {
socialPost: {
type: "array",
description:
"Array of post items. For Threads/Bluesky/X: each item is an independent post forming a thread. For LinkedIn/Facebook: 2nd item onward are comments on the first post.",
items: {
type: "object",
properties: {
integrationId: {
type: "string",
description: "Channel integration ID from postiz_list_channels",
},
isPremium: {
type: "boolean",
description: "Whether using premium features (affects X character limits)",
},
date: {
type: "string",
description: "ISO date string for scheduled posts (required when type='schedule')",
},
shortLink: {
type: "boolean",
description: "Whether to shorten links in the post",
},
type: {
type: "string",
enum: ["draft", "schedule", "now"],
description: "Post type: 'now' = publish immediately, 'schedule' = publish at date, 'draft' = save as draft",
},
postsAndComments: {
type: "array",
description: "Post content items with HTML content",
items: {
type: "object",
properties: {
content: {
type: "string",
description: "HTML content of the post. Use <p> for paragraphs, <strong> for bold, <br> for line breaks.",
},
},
required: ["content"],
},
},
settings: {
type: "object",
description: "Platform-specific settings (from integrationSchema)",
},
},
required: ["integrationId", "type", "postsAndComments"],
},
},
},
required: ["socialPost"],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_generate_image",
description: "Generate an AI image from a text prompt. Returns image ID and path for use in posts.",
parameters: {
type: "object",
properties: {
prompt: {
type: "string",
description: "Detailed text description of the image to generate",
},
},
required: ["prompt"],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_generate_video_options",
description: "List available video generation types and their parameters.",
parameters: {
type: "object",
properties: {},
required: [],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_video_function",
description: "Call video helper functions (e.g., get available voice IDs for text-to-speech videos).",
parameters: {
type: "object",
properties: {
identifier: {
type: "string",
description: "Video type identifier from postiz_generate_video_options",
},
functionName: {
type: "string",
description: "Helper function name (e.g., 'getVoiceIds')",
},
},
required: ["identifier", "functionName"],
},
},
},
{
type: "function" as const,
function: {
name: "postiz_generate_video",
description: "Generate a video from parameters. Use postiz_generate_video_options to discover available types.",
parameters: {
type: "object",
properties: {
identifier: {
type: "string",
description: "Video type identifier",
},
output: {
type: "object",
description: "Output configuration (resolution, format, etc.)",
},
customParams: {
type: "object",
description: "Custom parameters for the video generation",
},
},
required: ["identifier", "output"],
},
},
},
] as const;
/** Tool names for routing */
export const POSTIZ_TOOL_NAMES = POSTIZ_TOOLS.map((t) => t.function.name);
/** Map from postiz_ prefixed tool name to MCP native tool name */
export const POSTIZ_TOOL_NAME_MAP: Record<string, string> = {
postiz_list_channels: "integrationList",
postiz_get_platform_schema: "integrationSchema",
postiz_trigger_tool: "triggerTool",
postiz_schedule_post: "schedulePostTool",
postiz_generate_image: "generateImageTool",
postiz_generate_video_options: "generateVideoOptions",
postiz_video_function: "videoFunctionTool",
postiz_generate_video: "generateVideoTool",
};