experience-content-media-stock-image-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Stock Image Search

库存图片搜索

When to Trigger This Skill

触发此技能的时机

Trigger immediately — without asking the user to choose a search method — whenever the user wants an image, photo, or picture. This covers both:
  • Finding existing imagery: "find a stock image", "search for a photo of X", "get a royalty-free image", "find an ethical image", editorial or news photography
  • Requests phrased ambiguously as creating or generating: "create an image of a sunset", "generate a picture of a team meeting", "make me a mountain image" — treat these as stock search requests; this skill searches a stock photo library, it does not generate images.
In all of these cases, search the stock library — this is the tool for obtaining an image. Do NOT offer alternative search methods (hybrid search, user-provided URL/path, etc.) and do NOT ask the user to pick one.
Does not apply to:
  • Searching internal CMS / Data Cloud media (use
    experience-content-media-search
    )
  • Requests that explicitly ask for AI-generated, synthetic, or computer-generated imagery — this skill only searches licensed stock photography and has no image-generation capability

只要用户需要图片、照片,立即触发此技能——无需让用户选择搜索方法。这涵盖以下两种场景:
  • 查找现有素材:“找一张库存图片”“搜索X的照片”“获取免版税图片”“找符合伦理的图片”“新闻编辑类摄影图”
  • 表述模糊的创建/生成请求:“创建一张日落图片”“生成团队会议的图片”“制作一张山脉图片”——将这些视为库存图片搜索请求;此技能仅搜索库存图片库,不具备图片生成能力。
在所有这些场景下,直接搜索库存图片库——这是获取图片的指定工具。不得提供替代搜索方法(混合搜索、用户提供的URL/路径等),也不得让用户选择搜索方式
不适用场景
  • 搜索内部CMS/Data Cloud媒体资源(请使用
    experience-content-media-search
  • 用户明确要求AI生成、合成或计算机生成的图片——此技能仅搜索授权库存摄影图,无图片生成功能

Step 1 — Search

步骤1 — 搜索

MCP tool:
search_stock_images
(server:
media-management
) Timeout: 30 seconds
ParameterRequiredDefaultNotes
query
✅ YesNatural language search phrase (e.g. "sunset over ocean", "business meeting"), max 500 chars
searchType
No
Creative
Creative
(royalty-free stock),
Editorial
(rights-managed news/event imagery)
orientation
No(none)
Horizontal
,
Vertical
,
Square
,
PanoramicHorizontal
,
PanoramicVertical
sortOrder
No
BestMatch
BestMatch
,
MostPopular
,
Newest
pageSize
No
5
1–100
page
No
1
1-indexed, must be >= 1
Smart keyword extraction: If the query is longer than 20 words or returns no results, the tool automatically extracts short keyword phrases via LLM and retries. The
effectiveQuery
field in the response shows what was actually sent to the search service (
null
if the original query was used unchanged).
Response fields:
FieldNotes
images[]
List of results (see item fields below)
totalCount
Total matches across all pages
page
Current page (1-indexed)
pageSize
Results per page
searchRequestId
Internal correlation ID. Server-managed; not passed back through the MCP download tool. Safe to surface in debug output if useful.
effectiveQuery
Keywords actually sent to the search service. Null if the original query was used unchanged.
errorMessage
Non-null if the search failed
Each
images[]
item:
FieldNotes
assetId
Stock asset ID — required for download. Safe to display alongside the result if useful.
title
Image title
caption
Image description
thumbnailUrl
Small preview URL — use for grid display
previewUrl
Larger comp/preview URL — use for tile display
width
Max width in pixels
height
Max height in pixels
licenseModel
e.g.
royaltyfree
,
rightsmanaged
artist
Contributor/artist name
collection
Collection name

MCP工具
search_stock_images
(服务器:
media-management
超时时间:30秒
参数是否必填默认值说明
query
✅ 是自然语言搜索短语(如“海上日落”“商务会议”),最多500字符
searchType
Creative
Creative
(免版税库存图)、
Editorial
(受版权管理的新闻/活动素材)
orientation
(无)
Horizontal
(横向)、
Vertical
(纵向)、
Square
(方形)、
PanoramicHorizontal
(横向全景)、
PanoramicVertical
(纵向全景)
sortOrder
BestMatch
BestMatch
(最佳匹配)、
MostPopular
(最受欢迎)、
Newest
(最新)
pageSize
5
1–100之间取值
page
1
从1开始计数,取值必须≥1
智能关键词提取:如果查询语句超过20个单词或未返回结果,工具会通过LLM自动提取短关键词短语并重试。响应中的
effectiveQuery
字段显示实际发送给搜索服务的内容(如果原查询未修改则为
null
)。
响应字段
字段说明
images[]
结果列表(详见下方子项字段)
totalCount
所有页面的匹配结果总数
page
当前页码(从1开始计数)
pageSize
每页结果数量
searchRequestId
内部关联ID,由服务器管理;不会通过MCP下载工具返回,如需调试可展示。
effectiveQuery
实际发送给搜索服务的关键词。如果原查询未修改则为null。
errorMessage
搜索失败时非空
每个
images[]
子项
字段说明
assetId
库存素材ID——下载时必填,必要时可随结果展示。
title
图片标题
caption
图片描述
thumbnailUrl
小尺寸预览URL——用于网格展示
previewUrl
大尺寸预览URL——用于卡片展示
width
最大宽度(像素)
height
最大高度(像素)
licenseModel
许可模式,例如
royaltyfree
(免版税)、
rightsmanaged
(版权管理)
artist
贡献者/作者名称
collection
素材集名称

Step 2 — Present Results, then STOP

步骤2 — 展示结果,然后停止

Render a numbered list with an inline thumbnail for each result, using
thumbnailUrl
for the image and
previewUrl
as the click-through link (clicking the thumbnail opens the full preview in the browser):
text
1. [![<title>](<thumbnailUrl>)](<previewUrl>)
   **<title>** — <artist>, <width>×<height>, <licenseModel>
2. ...
This is standard markdown image-in-link syntax (
[![alt](thumbnailUrl)](previewUrl)
) — it renders an actual thumbnail, not just a text link, and clicking it navigates to
previewUrl
. If a client doesn't render markdown images, this degrades gracefully to a linked title.
Prefix the list with
Searched for: <effectiveQuery>
only if
effectiveQuery
is non-null and differs from the user's original query.
End the turn here. Do not auto-download, do not write files, do not ask a follow-up question. Agentforce injects its own selection UI — a question or auto-select causes a duplicate "double ask". Do not pick a result on behalf of the user.
Non-interactive mode (scheduled/headless, no user present): pick
images[0]
from the results and note the auto-selection in the report. Then proceed directly to Step 3.

使用编号列表展示结果,每个结果内嵌缩略图,用
thumbnailUrl
作为图片链接,
previewUrl
作为点击跳转链接(点击缩略图在浏览器中打开完整预览):
text
1. [![<title>](<thumbnailUrl>)](<previewUrl>)
   **<title>** — <artist>, <width>×<height>, <licenseModel>
2. ...
这是标准的Markdown图片链接语法(
[![alt](thumbnailUrl)](previewUrl)
)——会渲染实际缩略图而非仅文本链接,点击后跳转到
previewUrl
。如果客户端不支持渲染Markdown图片,会自动降级为带链接的标题。
仅当
effectiveQuery
非空且与用户原查询不同时,在列表前添加
搜索关键词:<effectiveQuery>
**在此步骤结束交互。不要自动下载、写入文件或提出后续问题。**Agentforce会注入自身的选择UI——额外提问或自动选择会导致重复请求。不得代用户选择结果。
非交互模式(定时/无头模式,无用户参与):从结果中选择
images[0]
,并在报告中注明自动选择,然后直接进入步骤3。

Step 3 — Download (billed)

步骤3 — 下载(需计费)

⚠️ Each call licenses the image and spends a stock-image download credit. Only invoke after the user explicitly selects an image (or in non-interactive mode, as noted above).
Before calling
download_stock_image
, verify:
  • User has explicitly named or numbered the image they want (or non-interactive mode is confirmed)
  • This is not an automatic retry of a previous download
MCP tool:
download_stock_image
(server:
media-management
) Timeout: 60 seconds
ParameterRequiredDefaultNotes
assetId
✅ YesStock asset ID from the prior
search_stock_images
result, max 50 chars
size
No
comp
comp
(web-quality composite, default),
medium_jpg
,
largest
(full res, can exceed 100 MB), max 50 chars
Use
largest
only when the user explicitly asks for full/original resolution.
Response fields:
FieldNotes
assetId
Stock asset ID that was downloaded
managedContentBodyId
Salesforce record ID where image bytes are stored
parentContentGenAiOutputId
Record tracking the download request
childContentGenAiOutputId
Record linking the request to the persisted body
byteCount
Size of the persisted image in bytes
format
Resolved image format (e.g.
jpg
,
png
,
eps
,
tiff
,
svg
)
url
URL to the persisted image — use this to download or preview it

⚠️ 每次调用都会授权使用图片并消耗库存图片下载额度。仅在用户明确选择图片后(或上述非交互模式下)调用。
调用
download_stock_image
前需验证:
  • 用户已明确指定或编号所需图片(或已确认处于非交互模式)
  • 不是之前下载请求的自动重试
MCP工具
download_stock_image
(服务器:
media-management
超时时间:60秒
参数是否必填默认值说明
assetId
✅ 是来自
search_stock_images
结果的库存素材ID,最多50字符
size
comp
comp
(网页质量合成图,默认)、
medium_jpg
(中等尺寸JPG)、
largest
(全分辨率,可能超过100MB),最多50字符
仅当用户明确要求全分辨率/原始尺寸时使用
largest
响应字段
字段说明
assetId
已下载的库存素材ID
managedContentBodyId
存储图片字节的Salesforce记录ID
parentContentGenAiOutputId
跟踪下载请求的记录ID
childContentGenAiOutputId
将请求与持久化内容关联的记录ID
byteCount
持久化图片的字节大小
format
解析后的图片格式(如
jpg
png
eps
tiff
svg
url
持久化图片的URL——用于下载或预览

Step 4 — Download to Client and Preview

步骤4 — 下载到客户端并预览

After a successful
download_stock_image
call, download the image locally and open it in VS Code.
You MUST use
download-stock-image.py
for this. Do not use
curl
,
wget
, or any other tool.
bash
python3 scripts/download-stock-image.py \
  --url "<url from download response>" \
  --id "<assetId>" \
  --format "<format from download response>" \
  --preview
The script retrieves org credentials via the
sf
CLI (
sf config get target-org
and
sf org auth show-access-token
), downloads the image with
Authorization: Bearer <accessToken>
to
stockimages/<assetId>.<format>
, and opens it in VS Code if
--preview
is passed.
Pass
--output-dir <path>
to override the default
stockimages/
directory.
Never resize or post-process the image. Use CSS (
width
,
height
,
object-fit
) to control display dimensions.
Vector/binary formats (
eps
,
tiff
):
always pass the exact
format
returned by the download response — never substitute a format like
jpg
to work around a validation error; the file bytes won't match the extension and the file will appear corrupted. VS Code cannot render
eps
/
tiff
previews, so the script skips
--preview
for those formats automatically and still reports the saved path.

成功调用
download_stock_image
后,将图片下载到本地并在VS Code中打开。
必须使用
download-stock-image.py
完成此操作,不得使用
curl
wget
或其他工具。
bash
python3 scripts/download-stock-image.py \
  --url "<下载响应中的url>" \
  --id "<assetId>" \
  --format "<下载响应中的format>" \
  --preview
该脚本通过
sf
CLI获取组织凭证(
sf config get target-org
sf org auth show-access-token
),使用
Authorization: Bearer <accessToken>
将图片下载到
stockimages/<assetId>.<format>
,如果传入
--preview
则在VS Code中打开。
可传入
--output-dir <路径>
覆盖默认的
stockimages/
目录。
**不得调整图片大小或进行后期处理。**使用CSS(
width
height
object-fit
)控制显示尺寸。
矢量/二进制格式(
eps
tiff
:必须传入下载响应返回的精确
format
——不得替换为
jpg
等格式来绕过验证错误,否则文件字节与扩展名不匹配会导致文件损坏。VS Code无法渲染
eps
/
tiff
预览,因此脚本会自动跳过
--preview
参数,但仍会报告保存路径。

Step 5 — Report Back

步骤5 — 反馈结果

After a successful download, tell the user:
  • Image title and artist
  • Local path to the saved image (printed by the script)
  • managedContentBodyId
  • Attribution:
    {artist} · {collection}
    (use the attribution string returned by the download response when present)

下载成功后,告知用户:
  • 图片标题和作者
  • 图片保存的本地路径(由脚本输出)
  • managedContentBodyId
  • 署名信息:
    {artist} · {collection}
    (如有下载响应返回的署名字符串则使用该字符串)

Fallbacks & Errors

降级方案与错误处理

SituationAction
errorMessage
non-null in search
Show it; suggest a simpler query or different
searchType
/
orientation
images
empty
Suggest broader keywords; try switching
Editorial
vs
Creative
effectiveQuery
differs
Inform user what the search service actually received
MCP tools unavailableUse the placeholder URL below — do not download or save
Download failsShow error; do NOT retry automatically — confirm with user first (each retry is billed)

场景操作
搜索响应中
errorMessage
非空
展示错误信息;建议使用更简单的查询或更换
searchType
/
orientation
images
结果为空
建议使用更宽泛的关键词;尝试切换
Editorial
Creative
类型
effectiveQuery
与原查询不同
告知用户搜索服务实际接收的关键词
MCP工具不可用使用下方的占位符URL——不得下载或保存
下载失败展示错误信息;不得自动重试——需先征得用户同意(每次重试都将计费)

Placeholder

占位符

If
search_stock_images
and
download_stock_image
are both unavailable, use this URL directly as
src
or CSS
url()
:
text
https://cdn.scs.static.lightning.force.com/content/assets/d5222d4a11e6c2b735152d7eea824ce4/placeholder.svg
Placeholder policy: There is only one placeholder URL. Do not download it, modify it, or generate alternative placeholders using Python, ImageMagick, or any other tool. If the user asks for a placeholder of a specific size or format, tell them only this URL is available and direct them to use CSS to scale it at the point of use.
如果
search_stock_images
download_stock_image
均不可用,直接使用以下URL作为
src
或CSS
url()
text
https://cdn.scs.static.lightning.force.com/content/assets/d5222d4a11e6c2b735152d7eea824ce4/placeholder.svg
占位符规则:仅提供此一个占位符URL。不得下载、修改或使用Python、ImageMagick等工具生成替代占位符。如果用户要求特定尺寸或格式的占位符,告知用户仅提供此URL,并指导他们在使用时通过CSS调整尺寸。