/** * 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
, , for paragraphs, for bold,
, ,
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