Skip to main content
Glama

find-assets

Search for existing files in Cloudinary using query expressions to locate images, videos, or raw assets by tags, public IDs, or other criteria.

Instructions

Search for existing files (assets) in Cloudinary with a query expression

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionNoSearch expression (e.g. 'tags=cat' or 'public_id:folder/*')
resourceTypeNoResource typeimage
maxResultsNoMaximum number of results
nextCursorNoNext cursor for pagination
tagsNoInclude tags in the response
contextNoInclude context in the response

Implementation Reference

  • The core handler function that executes the Cloudinary API search for assets based on the provided parameters, handles pagination, and formats the response or error.
    const findAssetsTool = async (cloudinary, { expression, resourceType, maxResults, nextCursor, tags, context, }) => { try { const options = { expression, resource_type: resourceType, max_results: maxResults, next_cursor: nextCursor, tags, context, }; const result = await cloudinary.api.search(options); if (!result?.total_count) { return { content: [ { type: "text", text: "No assets found matching the search criteria", }, ], isError: false, }; } return { content: [{ type: "text", text: JSON.stringify(result, null, 2), }], isError: false, }; } catch (error) { return getToolError(`Error searching assets: ${error.message}`, cloudinary); } };
  • Zod-based input schema defining parameters for the 'find-assets' tool, including search expression, resource type, pagination, and response options.
    export const findAssetsToolParams = { expression: z.string().optional().describe("Search expression (e.g. 'tags=cat' or 'public_id:folder/*')"), resourceType: z.enum(["image", "video", "raw"]).default("image").describe("Resource type"), maxResults: z.number().min(1).max(500).default(10).describe("Maximum number of results"), nextCursor: z.string().optional().describe("Next cursor for pagination"), tags: z.boolean().optional().describe("Include tags in the response"), context: z.boolean().optional().describe("Include context in the response"), };
  • src/index.js:67-72 (registration)
    Registers the 'find-assets' tool on the MCP server, associating it with the schema and the Cloudinary-bound handler.
    server.tool( "find-assets", "Search for existing files (assets) in Cloudinary with a query expression", findAssetsToolParams, getFindAssetsTool(cloudinary), );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yoavniran/cloudinary-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server