Skip to main content
Glama

get_copilot_metrics_for_enterprise

Retrieve daily GitHub Copilot usage metrics for enterprise-wide analysis, including code completions, chat activity, active users, and language/editor breakdowns.

Instructions

Get daily Copilot usage metrics for the entire GitHub Enterprise (code completions, chat usage, active users, language/editor breakdown)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enterpriseNoEnterprise slug (defaults to GITHUB_ENTERPRISE env var)
sinceNoStart date in YYYY-MM-DD format (defaults to 28 days ago)
untilNoEnd date in YYYY-MM-DD format (defaults to today)
force_refreshNoIgnore cache and fetch fresh data

Implementation Reference

  • The async handler function that implements the logic for 'get_copilot_metrics_for_enterprise' tool, including input validation, parameter defaults, and invoking the GitHub client.
    async ({ enterprise, since, until, force_refresh }) => {
      try {
        const ent = enterprise ?? defaultEnterprise;
        if (!ent) {
          return { content: [{ type: "text", text: "Enterprise slug is required. Set GITHUB_ENTERPRISE or pass 'enterprise' parameter." }], isError: true };
        }
    
        const today = new Date().toISOString().split("T")[0];
        const defaultSince = new Date();
        defaultSince.setUTCDate(defaultSince.getUTCDate() - 28);
        const s = since ?? defaultSince.toISOString().split("T")[0];
        const u = until ?? today;
    
        validateDateRange(s, u);
    
        const metrics = await client.fetchMetrics("enterprise", ent, s, u, force_refresh ?? false, { identifier: ent });
    
        return { content: [{ type: "text", text: JSON.stringify(metrics, null, 2) }] };
      } catch (error) {
        return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • The registration of 'get_copilot_metrics_for_enterprise' tool using the MCP server's tool registration method.
    server.tool(
      "get_copilot_metrics_for_enterprise",
      "Get daily Copilot usage metrics for the entire GitHub Enterprise (code completions, chat usage, active users, language/editor breakdown)",
      {
        enterprise: z.string().optional().describe("Enterprise slug (defaults to GITHUB_ENTERPRISE env var)"),
        since: z.string().optional().describe("Start date in YYYY-MM-DD format (defaults to 28 days ago)"),
        until: z.string().optional().describe("End date in YYYY-MM-DD format (defaults to today)"),
        force_refresh: z.boolean().optional().describe("Ignore cache and fetch fresh data"),
      },
      async ({ enterprise, since, until, force_refresh }) => {
        try {
          const ent = enterprise ?? defaultEnterprise;
          if (!ent) {
            return { content: [{ type: "text", text: "Enterprise slug is required. Set GITHUB_ENTERPRISE or pass 'enterprise' parameter." }], isError: true };
          }
    
          const today = new Date().toISOString().split("T")[0];
          const defaultSince = new Date();
          defaultSince.setUTCDate(defaultSince.getUTCDate() - 28);
          const s = since ?? defaultSince.toISOString().split("T")[0];
          const u = until ?? today;
    
          validateDateRange(s, u);
    
          const metrics = await client.fetchMetrics("enterprise", ent, s, u, force_refresh ?? false, { identifier: ent });
    
          return { content: [{ type: "text", text: JSON.stringify(metrics, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions 'daily' metrics and the types of data retrieved, which adds useful context. However, it lacks details on behavioral traits such as rate limits, authentication requirements, data freshness, or potential side effects like caching behavior implied by the force_refresh parameter.

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 and includes all necessary details without redundancy. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides a clear purpose and scope but lacks details on return values, error handling, or operational constraints. It is adequate for a read-only tool but could benefit from more context on data format or usage limits to be fully complete.

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%, so the schema fully documents all parameters. The description does not add any parameter-specific semantics beyond what the schema provides, such as explaining the format or implications of the metrics breakdown. Baseline score of 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get daily Copilot usage metrics') and resource ('for the entire GitHub Enterprise'), with explicit details on what metrics are included (code completions, chat usage, active users, language/editor breakdown). It distinguishes from sibling tools by specifying enterprise-level scope versus org/team-level alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly indicates when to use this tool by specifying 'for the entire GitHub Enterprise,' which differentiates it from sibling tools like get_copilot_metrics_for_org or get_copilot_metrics_for_team. However, it does not explicitly state when not to use it or provide alternative scenarios beyond the scope distinction.

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/tatsuyamiyazaki/copilot-usage-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server