Skip to main content
Glama

detect_membership

Determine if your protected content was used to train a suspect AI model by running membership inference with watermark detection and statistical analysis methods.

Instructions

Run membership inference to determine whether your protected content was used to train a suspect AI model. Provide content IDs (from your registered media) and the model to test. Methods: pattern (watermark detection), statistical (distribution analysis), combined (both). Returns a job_id — use check_job to poll for results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_idsYesUUIDs of your registered media to test against the suspect model
suspect_modelYesIdentifier or name of the AI model suspected of training on your content
methodNoInference method. Default: combined
tagsNoTags for organizing and filtering

Implementation Reference

  • Main implementation of the detect_membership tool. Contains the server.tool registration and the async handler function that executes the membership inference logic by calling the API endpoint /api/v1/detect/membership with the provided parameters.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "detect_membership",
        "Run membership inference to determine whether your protected content was used to train " +
          "a suspect AI model. Provide content IDs (from your registered media) and the model to test. " +
          "Methods: pattern (watermark detection), statistical (distribution analysis), " +
          "combined (both). Returns a job_id — use check_job to poll for results.",
        {
          content_ids: z
            .array(z.string())
            .min(1)
            .describe("UUIDs of your registered media to test against the suspect model"),
          suspect_model: z
            .string()
            .describe("Identifier or name of the AI model suspected of training on your content"),
          method: z
            .enum(["pattern", "statistical", "combined"])
            .optional()
            .describe("Inference method. Default: combined"),
          tags: z
            .array(z.string())
            .optional()
            .describe("Tags for organizing and filtering"),
        },
        async (params) => {
          try {
            const body: Record<string, unknown> = {
              content_ids: params.content_ids,
              suspect_model: params.suspect_model,
            };
            if (params.method) body.method = params.method;
            if (params.tags) body.tags = params.tags;
    
            const result = await api.post("/api/v1/detect/membership", body);
            const res = result as { job_id: string };
    
            return {
              content: [
                {
                  type: "text" as const,
                  text:
                    `Membership inference job created.\n\n` +
                    `Job ID: ${res.job_id}\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 definition for the detect_membership tool input parameters, including content_ids (array of UUIDs), suspect_model (string identifier), method (enum: pattern, statistical, combined, optional), and tags (array of strings, optional).
    {
      content_ids: z
        .array(z.string())
        .min(1)
        .describe("UUIDs of your registered media to test against the suspect model"),
      suspect_model: z
        .string()
        .describe("Identifier or name of the AI model suspected of training on your content"),
      method: z
        .enum(["pattern", "statistical", "combined"])
        .optional()
        .describe("Inference method. Default: combined"),
      tags: z
        .array(z.string())
        .optional()
        .describe("Tags for organizing and filtering"),
    },
  • Async handler function that processes the detect_membership request. Validates parameters, constructs the request body, calls the API client's post method to /api/v1/detect/membership, and returns formatted results with the job_id or error message.
    async (params) => {
      try {
        const body: Record<string, unknown> = {
          content_ids: params.content_ids,
          suspect_model: params.suspect_model,
        };
        if (params.method) body.method = params.method;
        if (params.tags) body.tags = params.tags;
    
        const result = await api.post("/api/v1/detect/membership", body);
        const res = result as { job_id: string };
    
        return {
          content: [
            {
              type: "text" as const,
              text:
                `Membership inference job created.\n\n` +
                `Job ID: ${res.job_id}\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,
        };
      }
    },
  • src/index.ts:14-14 (registration)
    Import statement for the detect_membership register function from the tools module.
    import { register as detectMembership } from "./tools/detect-membership.js";
  • src/index.ts:56-56 (registration)
    Registration call that registers the detect_membership tool with the MCP server instance.
    detectMembership(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