Skip to main content
Glama

protect_media

Apply preset protection levels to media files or text content to prevent AI training use. Choose standard or maximum protection for images, audio, or text inputs via URL or base64 encoding.

Instructions

Protect media using a curated preset level. Automatically selects the best combination of algorithms for the given media type. Simpler than run_algorithm — just specify standard or maximum protection. Provide either a public media_url, base64 media, or text content. Returns a job_id — use check_job to poll for results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_urlNoPublic URL of the media file to protect
mediaNoBase64-encoded media content (alternative to media_url)
textNoPlain text content to protect
mimeNoMIME type (e.g. image/png, audio/wav, text/plain)
levelNoProtection level: standard (fast, good protection) or maximum (slower, strongest protection). Default: standard
tagsNoTags for organizing and filtering
webhook_urlNoURL to receive a POST when the job completes
filenameNoOriginal filename for human-readable output naming

Implementation Reference

  • Main handler function that registers the protect_media tool with MCP server, defines the input schema, and implements the execution logic that calls the SDRM API /api/v1/protect endpoint with media data and protection level.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "protect_media",
        "Protect media using a curated preset level. Automatically selects the best " +
          "combination of algorithms for the given media type. Simpler than run_algorithm — " +
          "just specify standard or maximum protection. Provide either a public media_url, " +
          "base64 media, or text content. Returns a job_id — use check_job to poll for results.",
        {
          media_url: z
            .string()
            .url()
            .optional()
            .describe("Public URL of the media file to protect"),
          media: z
            .string()
            .optional()
            .describe("Base64-encoded media content (alternative to media_url)"),
          text: z
            .string()
            .optional()
            .describe("Plain text content to protect"),
          mime: z
            .string()
            .optional()
            .describe("MIME type (e.g. image/png, audio/wav, text/plain)"),
          level: z
            .enum(["standard", "maximum"])
            .optional()
            .describe(
              "Protection level: standard (fast, good protection) or maximum (slower, strongest protection). Default: standard",
            ),
          tags: z
            .array(z.string())
            .optional()
            .describe("Tags for organizing and filtering"),
          webhook_url: z
            .string()
            .url()
            .optional()
            .describe("URL to receive a POST when the job completes"),
          filename: z
            .string()
            .optional()
            .describe("Original filename for human-readable output naming"),
        },
        async (params) => {
          try {
            const body: Record<string, unknown> = {};
            if (params.media_url) body.media_url = params.media_url;
            if (params.media) body.media = params.media;
            if (params.text) body.text = params.text;
            if (params.mime) body.mime = params.mime;
            if (params.level) body.level = params.level;
            if (params.tags) body.tags = params.tags;
            if (params.webhook_url) body.webhook_url = params.webhook_url;
            if (params.filename) body.filename = params.filename;
    
            const result = await api.post("/api/v1/protect", body);
            const res = result as { job_id: string; status_url: string };
    
            return {
              content: [
                {
                  type: "text" as const,
                  text:
                    `Protection job created.\n\n` +
                    `Job ID: ${res.job_id}\n` +
                    `Status URL: ${res.status_url}\n\n` +
                    `Use check_job with this job_id to poll for results.`,
                },
              ],
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true as const,
            };
          }
        },
      );
    }
  • Zod schema defining the input parameters for protect_media: media_url, media (base64), text, mime type, protection level (standard/maximum), tags, webhook_url, and filename.
    {
      media_url: z
        .string()
        .url()
        .optional()
        .describe("Public URL of the media file to protect"),
      media: z
        .string()
        .optional()
        .describe("Base64-encoded media content (alternative to media_url)"),
      text: z
        .string()
        .optional()
        .describe("Plain text content to protect"),
      mime: z
        .string()
        .optional()
        .describe("MIME type (e.g. image/png, audio/wav, text/plain)"),
      level: z
        .enum(["standard", "maximum"])
        .optional()
        .describe(
          "Protection level: standard (fast, good protection) or maximum (slower, strongest protection). Default: standard",
        ),
      tags: z
        .array(z.string())
        .optional()
        .describe("Tags for organizing and filtering"),
      webhook_url: z
        .string()
        .url()
        .optional()
        .describe("URL to receive a POST when the job completes"),
      filename: z
        .string()
        .optional()
        .describe("Original filename for human-readable output naming"),
    },
  • src/index.ts:8-44 (registration)
    Import and registration of protect_media tool in the main server initialization - imported at line 8 and registered at line 44 with the MCP server and API client instances.
    import { register as protectMedia } from "./tools/protect-media.js";
    import { register as checkJob } from "./tools/check-job.js";
    import { register as searchMedia } from "./tools/search-media.js";
    import { register as listSearches } from "./tools/list-searches.js";
    import { register as detectAi } from "./tools/detect-ai.js";
    import { register as detectFingerprint } from "./tools/detect-fingerprint.js";
    import { register as detectMembership } from "./tools/detect-membership.js";
    import { register as registerMedia } from "./tools/register-media.js";
    import { register as listMedia } from "./tools/list-media.js";
    import { register as getMedia } from "./tools/get-media.js";
    import { register as updateMedia } from "./tools/update-media.js";
    import { register as deleteMedia } from "./tools/delete-media.js";
    import { register as getRights } from "./tools/get-rights.js";
    import { register as getBilling } from "./tools/get-billing.js";
    
    const apiKey = process.env.SDRM_API_KEY;
    if (!apiKey) {
      process.stderr.write(
        "Error: SDRM_API_KEY environment variable is required.\n" +
          "Get your API key at https://sdrm.io/api-keys\n",
      );
      process.exit(1);
    }
    
    const api = new ApiClient(apiKey, process.env.SDRM_BASE_URL);
    
    const server = new McpServer({
      name: "sdrm",
      version: "0.1.0",
    });
    
    // Discovery
    listAlgorithms(server, api);
    
    // Protection
    runAlgorithm(server, api);
    protectMedia(server, api);
  • Core execution logic that builds the request body from parameters, calls api.post('/api/v1/protect'), and returns formatted response with job_id and status_url or error message.
    async (params) => {
      try {
        const body: Record<string, unknown> = {};
        if (params.media_url) body.media_url = params.media_url;
        if (params.media) body.media = params.media;
        if (params.text) body.text = params.text;
        if (params.mime) body.mime = params.mime;
        if (params.level) body.level = params.level;
        if (params.tags) body.tags = params.tags;
        if (params.webhook_url) body.webhook_url = params.webhook_url;
        if (params.filename) body.filename = params.filename;
    
        const result = await api.post("/api/v1/protect", body);
        const res = result as { job_id: string; status_url: string };
    
        return {
          content: [
            {
              type: "text" as const,
              text:
                `Protection job created.\n\n` +
                `Job ID: ${res.job_id}\n` +
                `Status URL: ${res.status_url}\n\n` +
                `Use check_job with this job_id to poll for results.`,
            },
          ],
        };
      } catch (err) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${err instanceof Error ? err.message : String(err)}`,
            },
          ],
          isError: true as const,
        };
      }
    },
  • ApiClient.post method used by protect_media handler to make HTTP POST requests to the SDRM API with authentication headers.
    async post<T = unknown>(path: string, body: unknown): Promise<T> {
      return this.request<T>(new URL(`${this.baseUrl}${path}`), {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(body),
      });
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it's an asynchronous operation (returns job_id, requires polling with check_job), accepts multiple input formats (URL, base64, or text), automatically selects algorithms, and has different performance characteristics for protection levels. It doesn't mention authentication needs, rate limits, or error conditions, but covers the essential workflow.

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 perfectly front-loaded with the core purpose, followed by key usage details and workflow information. Every sentence earns its place: first states what it does, second explains the simplicity vs alternatives, third specifies input options, fourth explains the asynchronous nature. Zero waste, appropriately sized.

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

Completeness4/5

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

For a complex tool with 8 parameters, no annotations, and no output schema, the description does well by explaining the asynchronous workflow, input options, and comparison to alternatives. It covers the essential context an agent needs to use the tool correctly, though it could benefit from mentioning authentication requirements or error handling scenarios given the complexity.

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 8 parameters thoroughly. The description adds some context about parameter usage ('Provide either a public media_url, base64 media, or text content') and the level parameter ('standard (fast, good protection) or maximum (slower, strongest protection)'), but doesn't significantly enhance understanding beyond what the schema provides. Baseline 3 is appropriate.

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

Purpose5/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 ('protect media') and resource ('media'), and explicitly distinguishes it from sibling 'run_algorithm' by noting it's 'simpler' and uses 'curated preset level'. This provides clear differentiation from alternatives.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('simpler than run_algorithm — just specify standard or maximum protection') and mentions an alternative ('run_algorithm'). However, it doesn't explicitly state when NOT to use this tool or compare it to other siblings like 'register_media' or 'update_media' that might handle media differently.

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/sidearmDRM/mcp-server'

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