get-usage
Generate a detailed report on product environment usage, including storage, bandwidth, requests, and resource metrics for a specific date within the last three months.
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
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | 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 |
Implementation Reference
- src/tools/getUsageTool.js:9-29 (handler)Main handler function for the 'get-usage' tool. Calls Cloudinary API to fetch usage report for a given date and returns formatted JSON or 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); } };
- src/tools/getUsageTool.js:5-7 (schema)Zod schema defining the input parameters for the 'get-usage' tool, specifically an optional 'date' parameter.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 on the MCP server with its name, description, 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), );