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
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | UUID of the media asset to delete |
Implementation Reference
- src/tools/delete-media.ts:5-39 (handler)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, }; } }, ); } - src/tools/delete-media.ts:10-12 (schema)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); - src/api.ts:41-45 (helper)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", }); }