Appearance
Download Media Files with AI
Easy MCP AI can return media file contents as well as attachment metadata. The tool and your connected AI client's WordPress permissions must allow access to the attachment.
In this article
Prefer the Source URL
Ask your connected AI client to call wp_get_media with the attachment's media_id (the ID of the Media Library item). The response includes source_url, a URL for the media file. Use it when your client can download the URL. The file contents are not included by default.
Request the File Explicitly
If your client cannot download source_url, ask it to call wp_get_media again with the same media_id and include_file: true. This explicitly opts in to returning the file; without it, the tool returns metadata only.
The response includes the file as a base64-encoded embedded resource alongside the metadata. Base64 is a text encoding of the file data.
Understand File Limits
The file must exist on the WordPress site, and its actual location must be inside the site's uploads directory, where WordPress stores uploaded media. Missing files and files stored outside that directory are not returned. Offloaded files—files stored on a separate service instead of the site—are not returned either. Use source_url for those files instead.
The default limit is 5 MiB of file data before base64 encoding per request. If one request returns multiple files in a batch, their combined size counts toward the limit. If the combined size exceeds the limit, request the files separately.
Site developers can change the limit with the easy_mcp_ai_media_file_max_bytes filter. It must return a positive integer (a whole number greater than zero) representing bytes; invalid values leave the default limit in place.