get-enterprise-stats
Retrieve GitHub Enterprise statistics to monitor usage metrics and organizational data for enterprise-level GitHub instances.
Instructions
Get GitHub Enterprise statistics (only available for GitHub Enterprise)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/search.ts:157-181 (handler)The main handler function for the 'get-enterprise-stats' tool. It checks if GitHub Enterprise is configured, fetches stats from '/enterprise/stats/all' endpoint, or returns an error message.export async function getEnterpriseStats(): Promise<any> { const github = getGitHubApi(); const baseUrl = process.env.GITHUB_API_URL; // This function is only available for GitHub Enterprise if (!baseUrl) { return { error: 'This function is only available for GitHub Enterprise', }; } return tryCatchAsync(async () => { try { // Try to get enterprise stats const { data } = await github.getOctokit().request('GET /enterprise/stats/all'); return data; } catch (error) { // If not available, return basic information return { message: 'Enterprise stats not available or insufficient permissions', api_url: baseUrl, }; } }, 'Failed to get enterprise stats'); }
- src/server.ts:1134-1142 (registration)Registration of the 'get-enterprise-stats' tool in the server's listTools response, including its description and empty input schema.{ name: 'get-enterprise-stats', description: 'Get GitHub Enterprise statistics (only available for GitHub Enterprise)', inputSchema: { type: 'object', properties: {}, additionalProperties: false, }, },
- src/server.ts:1267-1269 (handler)Dispatch case in the CallToolRequest handler that invokes the getEnterpriseStats function.case 'get-enterprise-stats': result = await getEnterpriseStats(); break;