search_assets
Search pre-cleared, commercially licensed AI-generated assets matched to a creative brief. Returns a ranked shortlist with compliance status, format, platform, and rationale.
Instructions
Search PixelVault for pre-cleared, commercially licensed AI-generated assets matched to a creative brief. Every asset is sourced from licensed AI platforms (Adobe Firefly, Moonvalley) and carries a compliance-cleared status. Returns a ranked shortlist with compliance status, format, platform, and rationale.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brief | Yes | Natural language description of the visual asset needed. | |
| license_type | No | License type required. Auto-detected from brief if omitted. | |
| format | No | Asset format filter. | |
| vertical | No | Vertical: post production, editorial, or ecommerce. | |
| territory | No | Distribution territory (e.g. Worldwide, US Only). |
Implementation Reference
- src/index.js:100-127 (handler)The main handler function `handleSearchAssets` that executes the search_assets tool logic. It parses the brief/filters, calls the PixelVault API via apiFetch, formats the results, and returns the response.
async function handleSearchAssets(args) { const { brief, license_type, format, vertical, territory } = args; const filters = briefToFilters(brief, { license_type, format, vertical }); let data; try { data = await apiFetch('/assets?' + new URLSearchParams(filters).toString()); } catch (err) { return { content: [{ type: 'text', text: `Error querying PixelVault: ${err.message}\n\nVisit ${SITE_URL} directly.` }], isError: true }; } const assets = (data.assets || []).slice(0, 10); if (assets.length === 0) { return { content: [{ type: 'text', text: `No assets found for: "${brief}"\n\nTry a broader brief or visit ${SITE_URL}` }] }; } const text = [ `PixelVault — Pre-Cleared Asset Shortlist`, `Brief: "${brief}"`, territory ? `Territory: ${territory}` : null, `License: ${filters.use_case || 'All'} | Status: All Cleared`, ``, `${assets.length} candidates found:`, ``, ...assets.map((a, i) => formatAsset(a, i)), ``, `All assets are pre-cleared. Human approval required. Use generate_usage_agreement after approval.`, `Checkout: ${SITE_URL}`, ].filter(l => l !== null).join('\n'); return { content: [{ type: 'text', text }] }; } - src/index.js:58-68 (schema)Input schema for search_assets tool, defining the 'brief' (required), 'license_type', 'format', 'vertical', and 'territory' parameters with types and descriptions.
inputSchema: { type: 'object', properties: { brief: { type: 'string', description: 'Natural language description of the visual asset needed.' }, license_type: { type: 'string', enum: ['Film & TV', 'Editorial', 'Commercial'], description: 'License type required. Auto-detected from brief if omitted.' }, format: { type: 'string', enum: ['video', 'image'], description: 'Asset format filter.' }, vertical: { type: 'string', description: 'Vertical: post production, editorial, or ecommerce.' }, territory: { type: 'string', description: 'Distribution territory (e.g. Worldwide, US Only).' }, }, required: ['brief'], }, - src/index.js:55-69 (registration)Tool registration in the TOOLS array, defining the name 'search_assets', its description, and input schema.
{ name: 'search_assets', description: 'Search PixelVault for pre-cleared, commercially licensed AI-generated assets matched to a creative brief. Every asset is sourced from licensed AI platforms (Adobe Firefly, Moonvalley) and carries a compliance-cleared status. Returns a ranked shortlist with compliance status, format, platform, and rationale.', inputSchema: { type: 'object', properties: { brief: { type: 'string', description: 'Natural language description of the visual asset needed.' }, license_type: { type: 'string', enum: ['Film & TV', 'Editorial', 'Commercial'], description: 'License type required. Auto-detected from brief if omitted.' }, format: { type: 'string', enum: ['video', 'image'], description: 'Asset format filter.' }, vertical: { type: 'string', description: 'Vertical: post production, editorial, or ecommerce.' }, territory: { type: 'string', description: 'Distribution territory (e.g. Worldwide, US Only).' }, }, required: ['brief'], }, }, - src/index.js:180-188 (registration)The CallToolRequestSchema handler that routes the 'search_assets' tool name to the handleSearchAssets function via a switch statement.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { switch (name) { case 'search_assets': return await handleSearchAssets(args); case 'get_asset_details': return await handleGetAssetDetails(args); case 'generate_usage_agreement': return await handleGenerateUsageAgreement(args); default: throw new Error(`Unknown tool: ${name}`); } - src/index.js:24-40 (helper)Helper function `briefToFilters` used by handleSearchAssets to parse the natural language brief and extract relevant filters (use_case, format).
function briefToFilters(brief = '', overrides = {}) { const b = brief.toLowerCase(); let use_case = overrides.vertical || overrides.license_type || null; if (!use_case) { if (b.includes('film') || b.includes('tv') || b.includes('broadcast') || b.includes('streaming') || b.includes('b-roll')) { use_case = 'Film & TV'; } else if (b.includes('editorial') || b.includes('news') || b.includes('magazine')) { use_case = 'Editorial'; } else if (b.includes('ecommerce') || b.includes('brand') || b.includes('commercial')) { use_case = 'Commercial'; } } const filters = {}; if (use_case) filters.use_case = use_case; if (overrides.format) filters.type = overrides.format; return filters; } - src/index.js:42-52 (helper)Helper function `formatAsset` used by handleSearchAssets to format each asset into a human-readable string for the response.
function formatAsset(asset, index) { const lines = [ `[${index + 1}] ${asset.title || 'Untitled'} (ID: ${asset.asset_id || asset.id})`, ` Platform: ${asset.source_platform || 'Unknown'} | Status: ${asset.compliance_status || 'Cleared'} | Format: ${asset.type || 'Video'}`, ` Price: ${asset.price ? `$${asset.price}` : 'See site'}`, ]; if (asset.description) lines.push(` Description: ${asset.description}`); if (asset.emotional_tone) lines.push(` Tone: ${asset.emotional_tone}`); lines.push(` View: ${SITE_URL}`); return lines.join('\n'); }