Skip to main content
Glama

face_swap_photo

Swap faces between photos by providing a target photo and source face image. This tool enables face replacement in images for creative or practical applications.

Instructions

Swap a face onto a photo. Provide a target photo and a source face image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_image_urlYesURL or local path to the target photo (receives the new face)
source_face_urlYesURL or local path to the source face image
nameNoOptional name for the project

Implementation Reference

  • Handler function that executes the face_swap_photo tool - calls the Magic Hour API to create a face swap photo job with the target and source images, returns the project ID and status.
    async ({ target_image_url, source_face_url, name }) => {
      try {
        const result = await client.v1.faceSwapPhoto.create({
          assets: {
            targetFilePath: target_image_url,
            faceSwapMode: "all-faces",
            sourceFilePath: source_face_url,
          },
          name: name,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(
                {
                  id: result.id,
                  credits_charged: result.creditsCharged,
                  status: "queued",
                  message:
                    "Face swap photo job submitted. Use get_image_project_status to check progress.",
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            { type: "text" as const, text: `Error: ${error.message}` },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:158-172 (registration)
    Tool registration with name 'face_swap_photo', description, and input schema using zod validation for target_image_url, source_face_url, and optional name.
    server.tool(
      "face_swap_photo",
      "Swap a face onto a photo. Provide a target photo and a source face image.",
      {
        target_image_url: z
          .string()
          .describe("URL or local path to the target photo (receives the new face)"),
        source_face_url: z
          .string()
          .describe("URL or local path to the source face image"),
        name: z
          .string()
          .optional()
          .describe("Optional name for the project"),
      },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the core operation but lacks critical details: it doesn't specify whether this is a read-only or destructive operation, what permissions are needed, rate limits, output format, or error conditions. For a tool that likely modifies images, this is a significant gap.

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

Conciseness5/5

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

The description is extremely concise with just two sentences that directly state the tool's function and required inputs. Every word earns its place, and the information is front-loaded without unnecessary elaboration.

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?

For a tool with 3 parameters, no annotations, and no output schema, the description is inadequate. It covers the basic operation but misses crucial context about behavioral traits, output format, error handling, and differentiation from sibling tools. The agent would lack sufficient information to use this tool effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema by implying the relationship between 'target_image_url' (receives the face) and 'source_face_url' (provides the face), but doesn't provide additional syntax, format details, or constraints.

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 tool's purpose with specific verbs ('swap a face onto a photo') and identifies the resources involved ('target photo' and 'source face image'). However, it doesn't explicitly differentiate from sibling tools like 'face_swap_video', which performs a similar operation on video instead of photos.

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?

The description provides no guidance on when to use this tool versus alternatives like 'face_swap_video' or 'detect_faces'. It states what the tool does but offers no context about appropriate use cases, prerequisites, or exclusions.

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/andrianthan/magic-hour-mcp'

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