Skip to main content
Glama

get_copilot_metrics_for_org

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

Instructions

Get daily Copilot usage metrics for a GitHub Organization (code completions, chat usage, active users, language/editor breakdown)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgNoOrganization name (defaults to GITHUB_ORG 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 handler function that executes the logic for 'get_copilot_metrics_for_org' tool.
    async ({ org, since, until, force_refresh }) => {
      try {
        const o = org ?? defaultOrg;
        if (!o) {
          return { content: [{ type: "text", text: "Organization name is required. Set GITHUB_ORG or pass 'org' 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("org", o, s, u, force_refresh ?? false, { identifier: o });
    
        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 };
      }
    }
  • src/tools/org.ts:7-38 (registration)
    The registration of the 'get_copilot_metrics_for_org' tool using the MCP server instance.
    server.tool(
      "get_copilot_metrics_for_org",
      "Get daily Copilot usage metrics for a GitHub Organization (code completions, chat usage, active users, language/editor breakdown)",
      {
        org: z.string().optional().describe("Organization name (defaults to GITHUB_ORG 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 ({ org, since, until, force_refresh }) => {
        try {
          const o = org ?? defaultOrg;
          if (!o) {
            return { content: [{ type: "text", text: "Organization name is required. Set GITHUB_ORG or pass 'org' 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("org", o, s, u, force_refresh ?? false, { identifier: o });
    
          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 (e.g., code completions, chat usage), which adds context about what the tool returns. However, it lacks details on behavioral traits such as authentication requirements, rate limits, error handling, or data freshness (beyond 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 purpose and includes key details (daily metrics, specific breakdowns). There is no wasted language, and it effectively communicates the tool's function without unnecessary elaboration.

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 some context (e.g., metric types). However, for a tool with 4 parameters and no structured output information, it lacks details on return values, error cases, or operational constraints, leaving gaps in completeness for an AI agent to use it effectively.

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 already documents all parameters (org, since, until, force_refresh) with descriptions and defaults. The description does not add any additional meaning or clarification beyond what the schema provides, such as explaining relationships between parameters or usage nuances.

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 action ('Get daily Copilot usage metrics') and the resource ('for a GitHub Organization'), specifying the exact metrics included (code completions, chat usage, active users, language/editor breakdown). It distinguishes itself from sibling tools by focusing on organization-level metrics rather than enterprise, team, seat assignments, or usage summary.

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 implies usage context by specifying 'for a GitHub Organization,' which differentiates it from sibling tools like get_copilot_metrics_for_enterprise or get_copilot_metrics_for_team. However, it does not explicitly state when to use this tool versus those alternatives or provide any exclusions or prerequisites.

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