Skip to main content
Glama

get-asset

Retrieve detailed information about a Cloudinary asset, including metadata, tags, and context, by specifying its ID and resource type.

Instructions

Get the details of a specific file (asset)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetIdNoThe Cloudinary asset ID
publicIdNoThe public ID of the asset
resourceTypeNoType of asset. Default: image
typeNoDelivery type. Default: upload
tagsNoWhether to include the list of tag names. Default: false
contextNoWhether to include contextual metadata. Default: false
metadataNoWhether to include structured metadata. Default: false

Implementation Reference

  • The core handler function `getAssetTool` that implements the logic to retrieve Cloudinary asset details using either `publicId` or `assetId` via the Cloudinary API.
    const getAssetTool = async (cloudinary, params) => {
    	if (!params.assetId && !params.publicId) {
    		return getToolError("Error: Either assetId or publicId must be provided", cloudinary);
    	}
    
    	try {
    		const { assetId, publicId, tags, context, metadata, resourceType, type } = params;
    		let resource;
    
    		if (publicId) {
    			resource = await cloudinary.api.resource(publicId, {
    				resource_type: resourceType,
    				type: type,
    				tags,
    				context,
    				metadata,
    			});
    		} else {
    			const result = await cloudinary.api
    				.resources_by_asset_ids([assetId], {
    					tags, context, metadata,
    				});
    
    			resource = result.resources[0] || null;
    		}
    
    		return {
    			content: [{
    				type: "text",
    				text: JSON.stringify(resource, null, 2),
    			}],
    			isError: false,
    		};
    
    	} catch (error) {
    		return getToolError(`Error retrieving asset: ${error.message || "unknown error"}`, cloudinary);
    	}
    };
  • Zod schema defining input parameters for the `get-asset` tool, including assetId, publicId, and various options for resource type, delivery type, and metadata inclusion.
    export const getAssetToolParams = {
    	assetId: z.string().optional().describe("The Cloudinary asset ID"),
    	publicId: z.string().optional().describe("The public ID of the asset"),
    	resourceType: z.enum(["image", "raw", "video"]).optional().describe("Type of asset. Default: image"),
    	type: z.enum(["upload", "private", "authenticated", "fetch", "facebook", "twitter", "gravatar", "youtube", "hulu", "vimeo", "animoto", "worldstarhiphop", "dailymotion", "list"]).optional().describe("Delivery type. Default: upload"),
    	tags: z.boolean().optional().describe("Whether to include the list of tag names. Default: false"),
    	context: z.boolean().optional().describe("Whether to include contextual metadata. Default: false"),
    	metadata: z.boolean().optional().describe("Whether to include structured metadata. Default: false"),
    };
  • src/index.js:57-62 (registration)
    Registration of the `get-asset` tool on the MCP server instance, specifying name, description, input schema, and handler.
    server.tool(
    	"get-asset",
    	"Get the details of a specific file (asset)",
    	getAssetToolParams,
    	getGetAssetTool(cloudinary),
    );
  • Helper function that curries the raw tool handler to produce a function accepting `cloudinary` instance first, then `params`, matching the expected tool signature.
    const getCloudinaryTool = (tool) => {
    	return (cloudinary) => (params) => tool(cloudinary, params);
    };
    
    export default getCloudinaryTool;
  • Utility helper to generate standardized error responses for tools, including partial Cloudinary config for debugging.
    export const getToolError = (msg, cloudinary) => {
    	const conf = cloudinary.config()
    	return {
    		content: [{
    			type: "text",
    			text: `${msg} (cloud: ${conf.cloud_name}, key: ${conf.api_key.slice(0,4)}...)`,
    		}],
    		isError: true,
    	};
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), implying it's non-destructive, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or the format of returned details. For a tool with 7 parameters and no output schema, this leaves significant gaps in understanding how it behaves.

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 front-loads the core purpose without unnecessary words. It directly states what the tool does ('Get the details of a specific file (asset)'), making it easy to parse and understand quickly, with zero wasted information.

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?

Given the tool's complexity (7 parameters, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what 'details' include, how results are structured, or behavioral traits like error cases. For a retrieval tool with multiple optional parameters, more context is needed to guide effective use.

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%, meaning all parameters are documented in the input schema itself. The description adds no additional meaning about parameters beyond implying it retrieves 'details' of an asset. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 ('Get') and resource ('details of a specific file (asset)'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'find-assets' (which likely lists multiple assets) or 'delete-asset' (which removes assets), leaving some ambiguity about when to choose this specific retrieval tool.

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 prerequisites (e.g., needing an asset ID), compare it to 'find-assets' for searching multiple assets, or specify scenarios where this detailed retrieval is preferred over other operations like 'upload' or 'delete-asset'.

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