Get Media Library Images is a WordPress ability from Premium Addons for Elementor — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.

Install Free Plugin →

Get Media Library Images

Read-only

List images in the WordPress media library, filterable by search keyword, MIME type, or specific attachment IDs, so an existing image can be reused instead of uploaded again.

Requires the Premium Addons for Elementor plugin on WordPress 7.0+ for the Abilities API (abilities are registered only when the wp_register_ability() function exists). Dashboard, settings and site-inventory abilities (get-id-by-title, list-pages, list-templates, get-global-settings, get-settings, update-setting, scan-usage, disable-unused-widgets, clear-dynamic-assets, subscribe-newsletter) require the caller hold the 'manage_options' capability. premium-addons/create-page requires 'edit_pages'. premium-addons/get-widget-schema, premium-addons/get-addon-schema, premium-addons/list-available-elements, premium-addons/list-pa-addons, premium-addons/detect-atomic-support, premium-addons/check-elementor-element and premium-addons/create-elementor-template require 'edit_posts'. premium-addons/get-page-structure, premium-addons/get-element-settings, premium-addons/add-flexbox, premium-addons/add-container, premium-addons/update-element-settings, premium-addons/insert-widget, premium-addons/remove-element, premium-addons/change-post-status and premium-addons/duplicate-post require 'edit_post' on the target post_id, and deny requests for a nonexistent post_id outright.

What it does

This ability lists attachments from the WordPress media library, newest first. You can narrow results with a search keyword (matched against the attachment title, description and filename — not alt text), restrict by MIME type (defaults to 'image', matching every image/* type; pass a specific type like image/svg+xml to narrow further), or page through results (up to 100 per page). Passing ids fetches those exact attachment IDs instead — useful for re-resolving a previously chosen image — and overrides search, paging and the MIME filter. Each result carries the attachment ID, full-size URL, width and height (0 when the file has no stored dimensions), alt text, title and MIME type. Call this before premium-addons/upload-media to check whether a suitable image already exists, since the id and url it returns are exactly what the media control value in premium-addons/insert-widget or premium-addons/update-element-settings expects.

See it in action

You ask your AI assistant

"Show me the images in my media library with 'hero' in the title."

Inputs

Name Type Required Description
search string No Keyword matched against the attachment title, description and filename. Alt text is not searchable. Omit to list all.
ids array No Fetch these attachment IDs exactly, e.g. to re-resolve a previously chosen image. Overrides search, paging and the MIME filter.
mime_type string No Restrict by MIME type. "image" matches every image/* type; pass a specific type such as image/svg+xml to narrow it. Defaults to image.
per_page integer No How many images to return per page, clamped to a maximum of 100. Defaults to 20.
page integer No The page of results to return. Defaults to 1.

Returns

An object with an items array (id, url, width, height, alt, title, mime_type for each matching image), total (matching count), page, per_page, and total_pages.

Permission

The current user must have the 'upload_files' capability, checked via Admin_Helper::check_user_can('upload_files').

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.