retrieve_media_file
Fetch and retrieve specific media files by filename from the Anki MCP server, enabling efficient access to stored resources.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Name of the media file to retrieve |
Implementation Reference
- src/tools/media.ts:80-111 (handler)MCP tool registration and inline handler for 'retrieve_media_file'. The handler retrieves the media file content using ankiClient.media.retrieveMediaFile and returns a success message with content length or not found message.'retrieve_media_file', { filename: z.string().describe('Name of the media file to retrieve'), }, async ({ filename }) => { try { const content = await ankiClient.media.retrieveMediaFile({ filename }); if (content === false) { return { content: [ { type: 'text', text: `Media file "${filename}" not found`, }, ], }; } return { content: [ { type: 'text', text: `Successfully retrieved media file "${filename}". Content length: ${content.length} characters`, }, ], }; } catch (error) { throw new Error( `Failed to retrieve media file: ${error instanceof Error ? error.message : String(error)}` ); } } );