delete_media_file
Remove specific media files from the Anki MCP server by specifying the filename to manage and optimize storage efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Name of the media file to delete |
Implementation Reference
- src/tools/media.ts:15-31 (handler)The handler function executes the tool logic by calling ankiClient.media.deleteMediaFile with the filename parameter, returns a success message in MCP format, or throws an error if it fails.async ({ filename }) => { try { await ankiClient.media.deleteMediaFile({ filename }); return { content: [ { type: 'text', text: `Successfully deleted media file: ${filename}`, }, ], }; } catch (error) { throw new Error( `Failed to delete media file: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/media.ts:12-14 (schema)Zod input schema defining the 'filename' parameter as a required string.{ filename: z.string().describe('Name of the media file to delete'), },
- src/tools/media.ts:10-32 (registration)Registration of the 'delete_media_file' tool on the MCP server using server.tool(), including name, schema, and handler.server.tool( 'delete_media_file', { filename: z.string().describe('Name of the media file to delete'), }, async ({ filename }) => { try { await ankiClient.media.deleteMediaFile({ filename }); return { content: [ { type: 'text', text: `Successfully deleted media file: ${filename}`, }, ], }; } catch (error) { throw new Error( `Failed to delete media file: ${error instanceof Error ? error.message : String(error)}` ); } } );