Skip to main content
Glama

get-usage

Retrieve a detailed report on your Cloudinary product environment usage, including storage, bandwidth, requests, and add-on consumption for a specific date.

Instructions

Get a report on the status of your product environment usage, including storage, credits, bandwidth, requests, number of resources, and add-on usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoThe date for the usage report. Must be within the last 3 months and specified in the format: yyyy-mm-dd. Default: the current date

Implementation Reference

  • The core handler function for the 'get-usage' tool. It calls Cloudinary's API to fetch usage data for the specified date (optional) and returns a formatted JSON text response or an error.
    const getUsageTool = async (cloudinary, { date }) => {
    	try {
    		const usageOptions = {
    			date
    		};
    
    		const usageResult = await cloudinary.api.usage(usageOptions);
    
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(usageResult, null, 2)
    				}
    			],
    			isError: false,
    		};
    	} catch (error) {
    		return getToolError(`Error getting usage report from Cloudinary: ${error.message}`, cloudinary);
    	}
    };
  • Zod schema defining the input parameters for the 'get-usage' tool, specifically an optional 'date' string.
    export const getUsageToolParams = {
    	date: z.string().optional().describe("The date for the usage report. Must be within the last 3 months and specified in the format: yyyy-mm-dd. Default: the current date")
    }
  • src/index.js:77-82 (registration)
    Registers the 'get-usage' tool with the MCP server, providing the tool name, description, input schema, and handler function.
    server.tool(
    	"get-usage",
    	"Get a report on the status of your product environment usage, including storage, credits, bandwidth, requests, number of resources, and add-on usage",
    	getUsageToolParams,
    	getUsageTool(cloudinary),
    );
  • Helper function that curries tool handlers to accept the Cloudinary instance first, used to wrap the getUsageTool for registration.
    const getCloudinaryTool = (tool) => {
    	return (cloudinary) => (params) => tool(cloudinary, params);
    };

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