UNPKG

endgame-mcp

Version:

[![github](https://github.com/user-attachments/assets/72708ed2-ab7e-49b4-8bb4-00c452ab4a44)](https://endgame.dev)

36 lines (33 loc) 1.11 kB
import { getUsageAnalytics } from '../sdk.js'; /** * Usage tool for fetching organization analytics from the management API. * Uses the SDK to properly handle organization context and API communication. * * @param {object} params - Input parameters * @param {string} [params.orgName] - Organization name (optional, will be resolved from dotfile if not provided) * @param {string} [params.dirPath] - Directory path for resolving org from dotfile (defaults to current directory) * @returns {Promise<object>} Usage analytics for the organization */ export async function usageTool({ orgName, dirPath = process.cwd() } = {}) { try { // Use SDK method to fetch usage analytics (SDK handles org resolution internally) const data = await getUsageAnalytics({ orgName, dirPath }); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: error && error.message ? error.message : String(error), }, ], }; } }