Store media file
store_media_fileStores a file in Anki's media folder and returns the actual stored name, which may differ from the requested name, so you can reference it correctly in notes without overwriting existing files.
Instructions
Stores a file in Anki's media folder and returns the name Anki stored it under, which can differ from the requested name. Always use the returned NAME: put <img src="NAME"> (images) or [sound:NAME] (audio/video) into a note field. Never overwrites an existing file. To attach media while creating or updating a note, prefer the picture/audio/video params of add_note, add_notes and update_note_fields. source may be "clipboard" for the image the user just copied or pasted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Where the file comes from: an http(s) URL (Anki downloads it); an absolute path on the computer running Anki (Anki reads it); "clipboard" for the image currently copied on the computer running this server, e.g. a screenshot the user just pasted into the chat; or a base64 data URL ("data:image/png;base64,..."), only for base64 you already have from another tool. Never try to write out the bytes of an image you can only see. | |
| filename | No | Name to store the file under in the Anki media folder. Defaults to the last segment of a URL or path, or "pasted-<hash>.<ext>" for clipboard and data URLs. Anki may still rename it; the actual name is what gets used. |