Skip to main content
Glama

register_media

Register media on the Sidearm platform to establish provenance and apply protection against unauthorized use, with options for indexing, watermarking, and adversarial hardening.

Instructions

Register and protect media on the Sidearm platform. Modes: register (provenance signing only), search_ready (register + vector indexing), standard (search_ready + watermarks + AI-training poison), maximum (standard + style cloaking + adversarial hardening). Returns the created media object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_urlNoPublic URL of the media to register
mediaNoBase64-encoded media content to register
modeNoProtection level. Default: standard
expires_atNoISO 8601 datetime when this registration expires
tagsNoTags for organizing and filtering

Implementation Reference

  • The main handler function that executes the register_media tool. It processes the input parameters, constructs a request body, calls the API to register media at /api/v1/media endpoint, and returns the result formatted as MCP content.
    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.mode) body.mode = params.mode;
        if (params.expires_at) body.expires_at = params.expires_at;
        if (params.tags) body.tags = params.tags;
    
        const result = await api.post("/api/v1/media", body);
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(result, null, 2) },
          ],
        };
      } catch (err) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${err instanceof Error ? err.message : String(err)}`,
            },
          ],
          isError: true as const,
        };
      }
    },
  • Zod schema definition for the register_media tool's input parameters, including optional fields for media_url (public URL), media (base64 content), mode (protection level: register/search_ready/standard/maximum), expires_at (ISO 8601 datetime), and tags (array of strings).
      media_url: z
        .string()
        .url()
        .optional()
        .describe("Public URL of the media to register"),
      media: z
        .string()
        .optional()
        .describe("Base64-encoded media content to register"),
      mode: z
        .enum(["register", "search_ready", "standard", "maximum"])
        .optional()
        .describe("Protection level. Default: standard"),
      expires_at: z
        .string()
        .optional()
        .describe("ISO 8601 datetime when this registration expires"),
      tags: z
        .array(z.string())
        .optional()
        .describe("Tags for organizing and filtering"),
    },
  • The register function that defines and registers the register_media tool with the MCP server, including tool name, description, schema, and handler function.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "register_media",
        "Register and protect media on the Sidearm platform. " +
          "Modes: register (provenance signing only), search_ready (register + vector indexing), " +
          "standard (search_ready + watermarks + AI-training poison), " +
          "maximum (standard + style cloaking + adversarial hardening). Returns the created media object.",
        {
          media_url: z
            .string()
            .url()
            .optional()
            .describe("Public URL of the media to register"),
          media: z
            .string()
            .optional()
            .describe("Base64-encoded media content to register"),
          mode: z
            .enum(["register", "search_ready", "standard", "maximum"])
            .optional()
            .describe("Protection level. Default: standard"),
          expires_at: z
            .string()
            .optional()
            .describe("ISO 8601 datetime when this registration expires"),
          tags: z
            .array(z.string())
            .optional()
            .describe("Tags for organizing and filtering"),
        },
        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.mode) body.mode = params.mode;
            if (params.expires_at) body.expires_at = params.expires_at;
            if (params.tags) body.tags = params.tags;
    
            const result = await api.post("/api/v1/media", body);
            return {
              content: [
                { type: "text" as const, text: JSON.stringify(result, null, 2) },
              ],
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true as const,
            };
          }
        },
      );
    }
  • src/index.ts:15-15 (registration)
    Import statement for the register_media tool registration function from tools/register-media.js
    import { register as registerMedia } from "./tools/register-media.js";
  • src/index.ts:59-59 (registration)
    Call to register the register_media tool with the MCP server and API client
    registerMedia(server, api);

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