Skip to main content
Glama

find-assets

Search for files in Cloudinary using query expressions, retrieve results based on tags, context, or resource type, and manage pagination with cursor support.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler function implementing the 'find-assets' tool logic: constructs search options from params, calls cloudinary.api.search, and returns JSON results or no-results message.
    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.
    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)
    Registration of the 'find-assets' tool on the MCP server, providing name, description, params schema, and handler factory.
    server.tool( "find-assets", "Search for existing files (assets) in Cloudinary with a query expression", findAssetsToolParams, getFindAssetsTool(cloudinary), );
  • Exports the wrapped handler factory by applying getCloudinaryTool to the raw handler.
    export default getCloudinaryTool(findAssetsTool);
  • Utility factory that creates a curried version of the tool handler, injecting the cloudinary instance.
    const getCloudinaryTool = (tool) => { return (cloudinary) => (params) => tool(cloudinary, params); };

Other Tools

Related Tools

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