searching-media
Searches for and retrieves existing visual media (images, logos, icons, photos, graphics, banners, thumbnails, hero images, backgrounds) from sources such as Salesforce CMS, Data 360 or any other source. Use this skill ANY TIME a user request involves finding, searching, getting, fetching, retrieving, grab, looking up, locating media. NEVER call search_media_cms_channels, search_electronic_media tools directly — always go through this skill first. This skill must be activated before any tool is used for media search or retrieval, without exception. Takes PRIORITY and activates FIRST when ANY media search/retrieval is mentioned, regardless of what else happens with the media afterward. Triggers for requests like "search for logo", "find hero image", "get company logo", "locate icons", "fetch background image", "retrieve product photos". Handles the search and source selection workflow. Does not apply when the request is about brand search, to generate NEW images with AI, or edit existing images.
NPX Install
npx skill4agent add forcedotcom/afv-library searching-mediaTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Media Search
Scope
- Search for images in Salesforce CMS, Data Cloud
- Find existing visual assets to use in their app
- Retrieve media from connected sources
- Browse available images for their project
- Locate specific photos or graphics
- Generate new images with AI (use image generation tools)
- Create graphics or designs from scratch
- Edit or modify existing images
- Build custom visuals or diagrams
Before You Search
- First response MUST be text only: A numbered list of search sources for the user. No tool calls of any kind.
- Wait for user to reply with their selected option number
- Only then call the appropriate search tool (this is the FIRST tool call in the entire interaction)
- ❌ Calling ANY tool before the user picks a source (MCP tools, file reads, descriptor checks, etc.)
- ❌ "Checking which MCP tools are available" — do not probe or discover tools via tool calls
- ❌ Immediately calling or
search_electronic_mediasearch_media_cms_channels - ❌ Reading MCP tool descriptors or schemas to see what's available
- ❌ Deciding which search source to use without asking
- ✅ Respond with ONLY text — a numbered list of search sources
- ✅ Ask: "Which option would you like to use?"
- ✅ Wait for user to reply with their choice
- ✅ Then (and only then) call the tool they selected
Workflow Overview
Media Search Progress:
- [ ] Step 1: Check your own tool list for available search tools (no tool calls — just inspect what's in your context)
- [ ] Step 2: Present only the available options to the user as a numbered list (plain text, no tool calls)
- [ ] Step 3: Wait for the user to reply with their selection
- [ ] Step 4: Execute the selected search method (this is the first tool call)
- [ ] Step 5: Present all results to user for selection
- [ ] Step 6: Apply selected image to codePresenting Search Sources (First Response)
- → If present, include "Search using keywords"
search_media_cms_channels - → If present, include "Search using Data 360 hybrid search"
search_electronic_media - Always include "Other" as the last option
I can help you find that image. Where would you like to search?
[NUMBER]. [SEARCH SOURCE NAME] — [Brief description]
...
[NUMBER]. Other — Provide your own URL or path
Which option would you like to use?Examples
I can help you find that image. Where would you like to search?
1. Search using Data 360 hybrid search — Semantic search across Salesforce CMS and connected DAMs
2. Search using keywords — Search Salesforce CMS by keywords and taxonomies
3. Other — Provide your own URL or path
Which option would you like to use?search_media_cms_channelsI can help you find that image. Where would you like to search?
1. Search using keywords — Search Salesforce CMS by keywords and taxonomies
2. Other — Provide your own URL or path
Which option would you like to use?search_electronic_mediaI can help you find that image. Where would you like to search?
1. Search using Data 360 hybrid search — Semantic search across Salesforce CMS and connected DAMs
2. Other — Provide your own URL or path
Which option would you like to use?No automated media search sources are currently configured. Please provide a direct URL or asset library path.Executing the Selected Search Method
Search using keywords
search_media_cms_channels-
Analyze the query — Understand what the user is searching for (subject, attributes, domain)
-
Extract keywords — Concrete nouns that would appear in image metadata
- Use domain-specific synonyms
- Maximum 10 terms
- Examples:
- "luxury apartments" → apartment, villa, penthouse, residence, condo
- "company logo" → logo, emblem, corporate logo
- "bright room" → (empty if no concrete nouns)
-
Extract taxonomies — Descriptive qualities, styles, moods, categories
- Only adjectives and attributes
- Examples:
- "luxury apartment with river view" → Luxury, Premium, Waterfront, Riverside, Panoramic
- "bright spacious room" → Bright, Spacious, Open, Airy, Light
- "car" → (empty if no descriptive terms)
-
Determine locale — Use format,
en_US,es_MX(default:fr_FR)en_US -
Build the JSON payload — Construct this exact structure:
{
"inputs": [{
"searchKeyword": "keyword1 OR keyword2 OR keyword3",
"taxonomyExpression": "{\"OR\": [\"Taxonomy1\", \"Taxonomy2\"]}",
"searchLanguage": "en_US",
"channelIds": "",
"channelType": "PublicUnauthenticated",
"contentTypeFqn": "sfdc_cms__image",
"pageOffset": 0,
"searchLimit": 5
}]
}- : Join keywords with
searchKeyword(space-OR-space). Use empty string if no keywords.OR - : Stringify JSON object
taxonomyExpression. Use{"OR": ["term1", "term2"]}if no taxonomies."{}" - : Locale with underscore (e.g.,
searchLanguage)en_US - : Always empty string
channelIds - : Always
channelType"PublicUnauthenticated" - : Always
contentTypeFqn"sfdc_cms__image" - : Start at
pageOffset, increment by0for paginationsearchLimit - : Default
searchLimit, adjust if user requests more5
{
"inputs": [{
"searchKeyword": "apartment OR villa OR penthouse OR residence",
"taxonomyExpression": "{\"OR\": [\"Luxury\", \"Premium\", \"Waterfront\", \"Riverside\"]}",
"searchLanguage": "en_US",
"channelIds": "",
"channelType": "PublicUnauthenticated",
"contentTypeFqn": "sfdc_cms__image",
"pageOffset": 0,
"searchLimit": 5
}]
}{
"inputs": [{
"searchKeyword": "",
"taxonomyExpression": "{\"OR\": [\"Bright\", \"Spacious\", \"Open\", \"Airy\"]}",
"searchLanguage": "en_US",
"channelIds": "",
"channelType": "PublicUnauthenticated",
"contentTypeFqn": "sfdc_cms__image",
"pageOffset": 0,
"searchLimit": 5
}]
}{
"inputs": [{
"searchKeyword": "car OR automobile OR vehicle OR auto",
"taxonomyExpression": "{}",
"searchLanguage": "en_US",
"channelIds": "",
"channelType": "PublicUnauthenticated",
"contentTypeFqn": "sfdc_cms__image",
"pageOffset": 0,
"searchLimit": 5
}]
}- Call the tool with the exact JSON payload
Search using Data 360 hybrid search
search_electronic_media- Use the user's query as-is — no keyword extraction or transformation needed
- Call
search_electronic_media - Pass the query to the tool's parameter
searchQuery
- User query: "modern luxury apartment with natural lighting"
- Tool call:
search_electronic_media(searchQuery="modern luxury apartment with natural lighting")
Other (User-Provided URL)
- Direct URL to the image
- Asset library path
- Specific system/location to check
Presenting Search Results
I found 4 images. Which one would you like to use?
1. Luxury Apartment Exterior
Source: Salesforce CMS
2. Modern High-Rise Building
Source: Salesforce CMS
3. Waterfront Residence
Source: Salesforce CMS
4. Premium Condominium
Source: Salesforce CMSApplying the Selected Image
- Confirm the selection with image name and URL
- Use the complete URL returned by the tool, including all query parameters. CMS and DAM URLs rely on query parameters for authentication, resizing, and CDN routing — dropping them breaks the image. For example, a URL like must be used in full.
https://cms.example.com/media/img.jpg?oid=00D&refid=0EM&v=2 - Apply the URL to the user's code/component
- Show what was changed (file path and line number)
Error Handling
| Error | Response |
|---|---|
| Tool unavailable | "The [source name] tool is unavailable. Would you like to try a different source?" |
| Tool returns error | Show error message, offer retry with different terms or alternative source |
| No results found | "No results found. Try broader keywords, removing descriptive terms, or a different source." |
| Invalid user selection | Re-display options and ask again |
Search Behavior Notes
- Both keyword and taxonomy → results match keyword OR (keyword + taxonomy)
- Empty keyword → search by taxonomy only
- Empty taxonomy → search by keyword only
- Use for pagination (increment by
pageOffset)searchLimit
- Handles natural language queries
- Semantic similarity matching
- Searches across multiple connected systems
Key Principles
- First response is always text-only — Present search sources without calling any tool
- Only show configured sources — Check your own tool list (introspection, not tool calls) and only present sources whose tools you have
- Wait for user selection — Never auto-select a source or image
- Show all results — Let the user choose the best match
- Confirm before applying — Verify the selection before modifying code
- Handle errors gracefully — Provide clear feedback and alternatives