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),
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions searching with a query expression but doesn't describe what the tool returns (e.g., list of assets, metadata), pagination behavior (implied by 'nextCursor' parameter but not explained), rate limits, authentication needs, or error conditions. This is inadequate for a search tool with 6 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that immediately conveys the core functionality. It's front-loaded with the essential action ('search for existing files') and includes the key constraint ('with a query expression'). There's no wasted verbiage or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how results are structured, pagination mechanics (despite a 'nextCursor' parameter), or error handling. The agent would lack sufficient context to use this tool effectively beyond basic invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description adds no parameter-specific information beyond mentioning 'query expression' (which aligns with the 'expression' parameter). This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('search') and resource ('existing files (assets) in Cloudinary'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-asset' (which likely retrieves a specific asset) or 'upload' (which creates new assets), missing full sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer 'find-assets' over 'get-asset' for retrieving specific assets or how it relates to 'delete-asset' or 'upload'. There's no context about prerequisites or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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