Skip to main content
Glama

delete_media

Permanently delete a registered media asset by removing storage files, vector embeddings, and all associated metadata. This action cannot be undone.

Instructions

Permanently delete a registered media asset. Removes storage files, vector embeddings, and all associated metadata. This action cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_idYesUUID of the media asset to delete

Implementation Reference

  • Main handler implementation for delete_media tool. Contains the register function that defines the tool with its schema and async handler that calls the API to delete media.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "delete_media",
        "Permanently delete a registered media asset. Removes storage files, " +
          "vector embeddings, and all associated metadata. This action cannot be undone.",
        {
          media_id: z.string().describe("UUID of the media asset to delete"),
        },
        async ({ media_id }) => {
          try {
            await api.delete(
              `/api/v1/media/${encodeURIComponent(media_id)}`,
            );
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Media ${media_id} deleted successfully.`,
                },
              ],
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true as const,
            };
          }
        },
      );
    }
  • Input schema definition using zod for the delete_media tool, validating that media_id is a required string UUID.
    {
      media_id: z.string().describe("UUID of the media asset to delete"),
    },
  • src/index.ts:19-19 (registration)
    Import statement for the delete_media tool registration function.
    import { register as deleteMedia } from "./tools/delete-media.js";
  • src/index.ts:63-63 (registration)
    Registration call that registers the delete_media tool with the MCP server.
    deleteMedia(server, api);
  • ApiClient.delete method used by the delete_media handler to make HTTP DELETE requests to the API.
    async delete<T = unknown>(path: string): Promise<T> {
      return this.request<T>(new URL(`${this.baseUrl}${path}`), {
        method: "DELETE",
      });
    }

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