Skip to main content
Glama

Prepare Platform Publish Package

platform_prepare_package

Generates video publishing metadata for multiple short video platforms, including title, description, tags, and platform-specific formatting, based on a provided video file and job ID.

Instructions

Generate publishing metadata for different short video platforms.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobIdYes
finalVideoPathYes
titleYes
descriptionNo
tagsNo
platformsYes

Implementation Reference

  • Handler function for 'platform_prepare_package' tool. Generates publish metadata packages for each platform (douyin, xiaohongshu, bilibili, youtube_shorts, tiktok). For each platform, it creates a package entry with platform-specific title modifications (e.g., '#Shorts' suffix for youtube_shorts), platform-specific tags (e.g., extra AI tags for xiaohongshu), aspect ratio (9:16 for vertical platforms, 16:9 for bilibili), and writes all packages to jobs/{jobId}/publish/packages.json.
    server.registerTool(
      'platform_prepare_package',
      {
        title: 'Prepare Platform Publish Package',
        description: 'Generate publishing metadata for different short video platforms.',
        inputSchema: z.object({
          jobId: z.string(),
          finalVideoPath: z.string(),
          title: z.string(),
          description: z.string().default(''),
          tags: z.array(z.string()).default([]),
          platforms: z.array(z.enum(['douyin', 'xiaohongshu', 'bilibili', 'youtube_shorts', 'tiktok']))
        })
      },
      async ({ jobId, finalVideoPath, title, description, tags, platforms }) => {
        try {
          safePath(finalVideoPath);
          const packages = platforms.map((platform) => ({
            platform,
            video: finalVideoPath,
            title: platform === 'youtube_shorts' ? `${title} #Shorts` : title,
            description,
            tags: platform === 'xiaohongshu' ? [...tags, 'AI视频', '视觉灵感'] : tags,
            aspect: ['douyin', 'xiaohongshu', 'youtube_shorts', 'tiktok'].includes(platform) ? '9:16' : '16:9',
            status: 'ready_for_manual_or_api_publish'
          }));
          const outputPath = safePath(`jobs/${jobId}/publish/packages.json`);
          await writeJsonFile(outputPath, packages);
          return textResult({ ok: true, outputPath: `jobs/${jobId}/publish/packages.json`, packages });
        } catch (err) {
          return errorResult('Failed to prepare publish package', String(err));
        }
      }
  • Input schema for 'platform_prepare_package'. Required fields: jobId (string), finalVideoPath (string), title (string), platforms (array of 'douyin'|'xiaohongshu'|'bilibili'|'youtube_shorts'|'tiktok'). Optional fields with defaults: description (empty string), tags (empty array).
    {
      title: 'Prepare Platform Publish Package',
      description: 'Generate publishing metadata for different short video platforms.',
      inputSchema: z.object({
        jobId: z.string(),
        finalVideoPath: z.string(),
        title: z.string(),
        description: z.string().default(''),
        tags: z.array(z.string()).default([]),
        platforms: z.array(z.enum(['douyin', 'xiaohongshu', 'bilibili', 'youtube_shorts', 'tiktok']))
      })
    },
  • Tool registration within registerPipelineTools(). The tool is registered on the McpServer instance via server.registerTool() with the name 'platform_prepare_package'.
    server.registerTool(
      'platform_prepare_package',
      {
        title: 'Prepare Platform Publish Package',
        description: 'Generate publishing metadata for different short video platforms.',
        inputSchema: z.object({
          jobId: z.string(),
          finalVideoPath: z.string(),
          title: z.string(),
          description: z.string().default(''),
          tags: z.array(z.string()).default([]),
          platforms: z.array(z.enum(['douyin', 'xiaohongshu', 'bilibili', 'youtube_shorts', 'tiktok']))
        })
      },
      async ({ jobId, finalVideoPath, title, description, tags, platforms }) => {
        try {
          safePath(finalVideoPath);
          const packages = platforms.map((platform) => ({
            platform,
            video: finalVideoPath,
            title: platform === 'youtube_shorts' ? `${title} #Shorts` : title,
            description,
            tags: platform === 'xiaohongshu' ? [...tags, 'AI视频', '视觉灵感'] : tags,
            aspect: ['douyin', 'xiaohongshu', 'youtube_shorts', 'tiktok'].includes(platform) ? '9:16' : '16:9',
            status: 'ready_for_manual_or_api_publish'
          }));
          const outputPath = safePath(`jobs/${jobId}/publish/packages.json`);
          await writeJsonFile(outputPath, packages);
          return textResult({ ok: true, outputPath: `jobs/${jobId}/publish/packages.json`, packages });
        } catch (err) {
          return errorResult('Failed to prepare publish package', String(err));
        }
      }
    );
  • src/index.ts:23-23 (registration)
    Top-level entry point where registerPipelineTools is called with the McpServer instance, which registers platform_prepare_package among other pipeline tools.
    registerPipelineTools(server);
  • Helper function safePath() used within the tool handler to validate and resolve file paths against VIDEO_FACTORY_ROOT, preventing directory traversal.
    export function safePath(input: string) {
      ensureRoot();
      const resolved = path.resolve(config.root, input);
      if (!resolved.startsWith(config.root)) {
        throw new Error(`Path escapes VIDEO_FACTORY_ROOT: ${input}`);
      }
      return resolved;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose any behavioral traits such as side effects, authentication needs, or rate limits. The agent is left unaware of what 'generating metadata' entails beyond the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise with a single sentence, which is front-loaded but lacks necessary detail. It is appropriate in length but could benefit from expanding on key aspects.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It does not explain what the output is, how it interacts with other tools, or the behavior of the job lifecycle.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 0% description coverage, and the tool description adds no meaning to the parameters. Six parameters are listed without any explanation of their roles or constraints, leaving the agent to guess.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'generate' and the resource 'publishing metadata for different short video platforms,' distinguishing it from sibling tools like rendering or transcoding. However, 'publish package' is not fully explained.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, nor any prerequisites or conditions. The description only states the general purpose without context for proper invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Eliveral/codex-mcp-comfy-ae-video-factory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server